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
This commit is contained in:
parent
72e038b027
commit
12dff6d870
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user