⬢ DragonFlyBSD Kernel Audit
DF-4080 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/oce/oce_if.c
+++ b/sys/dev/netif/oce/oce_if.c
@@ -337,10 +337,17 @@
 
 	ether_ifdetach(sc->ifp);
 
-	if_free(sc->ifp);
-
+	/*
+	 * DF-4080: oce_if_deactivate() deliberately returns with
+	 * interrupts ENABLED and EQ0 armed (MCC async events).  Shut the
+	 * device down -- which disables interrupts and destroys the queues
+	 * -- BEFORE freeing the ifnet, so no late async event can reach
+	 * oce_mq_handler/oce_rq_handler through a freed sc->ifp.
+	 */
 	oce_hw_shutdown(sc);
 
+	if_free(sc->ifp);
+
 	bus_generic_detach(dev);
 	return 0;
 }