⬢ DragonFlyBSD Kernel Audit
DF-3712 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/em/if_em.c	2026-09-15 21:39:34.188447660 +0000
+++ b/sys/dev/netif/em/if_em.c	2026-09-15 21:39:38.668390864 +0000
@@ -3375,7 +3375,16 @@
 	}
 	m->m_len = m->m_pkthdr.len = MCLBYTES;
 
-	if (adapter->hw.mac.max_frame_size <= MCLBYTES - ETHER_ALIGN)
+	/*
+	 * Only front-trim the posted buffer while standard-size frames
+	 * are admitted.  For any MTU that enables long packet reception
+	 * (RCTL_LPE, em_init_rx_unit()), the first descriptor of a
+	 * multi-descriptor frame is filled with the full 2048-byte
+	 * (RCTL_SZ_2048) buffer, which would overrun the 2046-byte
+	 * front-trimmed DMA mapping by 2 bytes: a DMA heap overflow
+	 * past the mbuf cluster.
+	 */
+	if (adapter->hw.mac.max_frame_size <= ETHER_MAX_LEN)
 		m_adj(m, ETHER_ALIGN);
 
 	error = bus_dmamap_load_mbuf_segment(adapter->rxtag,