DragonFlyBSD Kernel Audit
DF-1479 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/my/if_my.c
+++ b/sys/dev/netif/my/if_my.c
@@ -1362,7 +1362,13 @@
 		sc->my_cdata.my_tx_free = cur_tx->my_nextdesc;
 
 		/* Pack the data into the descriptor. */
-		my_encap(sc, cur_tx, m_head);
+		if (my_encap(sc, cur_tx, m_head) != 0) {
+			m_freem(m_head);
+			sc->my_cdata.my_tx_free = cur_tx;
+			cur_tx = (cur_tx == start_tx) ? NULL : cur_tx;
+			IFNET_STAT_INC(ifp, oerrors, 1);
+			break;
+		}
 
 		if (cur_tx != start_tx)
 			MY_TXOWN(cur_tx) = MY_OWNByNIC;