⬢ DragonFlyBSD Kernel Audit
DF-4108 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/vge/if_vge.c
+++ b/sys/dev/netif/vge/if_vge.c
@@ -1619,7 +1619,12 @@ vge_encap(struct vge_softc *sc, struct mbuf *m_head, int idx)
 	arg.sc = sc;
 	arg.vge_idx = idx;
 	arg.vge_m0 = m_head;
-	arg.vge_maxsegs = VGE_TX_FRAGS;
+	/*
+	 * Reserve one fragment slot for the short-frame pad entry that
+	 * vge_dma_map_tx_desc appends when m_pkthdr.len < VGE_MIN_FRAMELEN;
+	 * admitting nseg == VGE_TX_FRAGS makes that pad write land in
+	 * vge_frag[7] (the next descriptor's vge_sts/vge_ctl).
+	 */
+	arg.vge_maxsegs = VGE_TX_FRAGS - 1;
 
 	map = sc->vge_ldata.vge_tx_dmamap[idx];