⬢ DragonFlyBSD Kernel Audit
DF-4940 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/ic/if_ic.c	2026-09-25 07:24:38.504972636 +0000
+++ b/sys/dev/netif/ic/if_ic.c	2026-09-25 07:24:51.912799296 +0000
@@ -344,7 +347,17 @@
 	u_char *cp;
 	uint32_t hdr = dst->sa_family;
 
-	ifp->if_flags |= IFF_RUNNING;
+	/*
+	 * Do not transmit unless the interface was brought up properly
+	 * (buffers allocated, bus acquired).  Setting IFF_RUNNING here
+	 * bypassed the SIOCSIFFLAGS state machine (DF-4940).
+	 */
+	if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING) ||
+	    sc->ic_obuf == NULL || sc->ic_ifbuf == NULL) {
+		IFNET_STAT_INC(ifp, oerrors, 1);
+		m_freem(m);
+		return (ENETDOWN);
+	}
 
 	crit_enter();