From 18628b74bd2bf0ddcdf56fd0fe09e929db4f662d Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sun, 25 Mar 2018 23:23:19 +0000 Subject: [PATCH] Clamp IFLIB_RX_COPY_THRESH to MHLEN in iflib_rxd_pkt_get(). If one has added fields to struct mbuf such that MHLEN is smaller than this threshold (128), iflib_rxd_pkt_get() may otherwise overrun the internal mbuf buffer while copying. Reviewed by: mmacy MFC after: 3 days Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14843 --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 573330c8e13..d0c205dcbf7 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2450,7 +2450,7 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) /* should I merge this back in now that the two paths are basically duplicated? */ if (ri->iri_nfrags == 1 && - ri->iri_frags[0].irf_len <= IFLIB_RX_COPY_THRESH) { + ri->iri_frags[0].irf_len <= MIN(IFLIB_RX_COPY_THRESH, MHLEN)) { rxd_frag_to_sd(rxq, &ri->iri_frags[0], FALSE, &sd); m = *sd.ifsd_m; *sd.ifsd_m = NULL;