DragonFlyBSD Kernel Audit
DF-1082 / fix.diff
← back to finding ↓ download raw
--- /tmp/orig/bus/u4b/net/usb_ethernet.c	2026-07-23 11:54:56.724854000 +0000
+++ bus/u4b/net/usb_ethernet.c	2026-07-23 11:57:17.676284000 +0000
@@ -285,13 +285,14 @@
 		/* drain any callouts */
 		usb_callout_drain(&ue->ue_watchdog);
 
+		/* detach ethernet first to close SIOCGIFMEDIA window */
+		ether_ifdetach(ifp);
+
 		/* detach miibus */
 		if (ue->ue_miibus != NULL) {
 			device_delete_child(ue->ue_dev, ue->ue_miibus);
+			ue->ue_miibus = NULL;
 		}
-
-		/* detach ethernet */
-		ether_ifdetach(ifp);
 
 		/* free sysctl */
 		sysctl_ctx_free(&ue->ue_sysctl_ctx);