⬢ DragonFlyBSD Kernel Audit
DF-3806 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/msk/if_msk.c
+++ b/sys/dev/netif/msk/if_msk.c
@@ -2933,7 +2933,18 @@
 	struct ifnet *ifp = &sc_if->arpcom.ac_if;
 	struct mii_data *mii;
 
-	lwkt_serialize_enter(ifp->if_serializer);
+	/*
+	 * Never block on the serializer here: msk_stop() calls the
+	 * synchronous callout_stop() while holding it (if_msk.c:3687-3689),
+	 * so a tick parked in lwkt_serialize_enter deadlocks the callout
+	 * subsystem against the driver (AB-BA).  Try to enter; if the
+	 * serializer is contended (typically by msk_stop()/msk_init())
+	 * just retry on the next tick.
+	 */
+	if (lwkt_serialize_try(ifp->if_serializer) == 0) {
+		callout_reset(&sc_if->msk_tick_ch, 1, msk_tick, sc_if);
+		return;
+	}
 
 	mii = device_get_softc(sc_if->msk_miibus);