⬢ DragonFlyBSD Kernel Audit
DF-5562 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/u4b/controller/ohci_pci.c b/sys/bus/u4b/controller/ohci_pci.c
--- a/sys/bus/u4b/controller/ohci_pci.c
+++ b/sys/bus/u4b/controller/ohci_pci.c
@@ -324,9 +324,15 @@ static int
 ohci_pci_detach(device_t self)
 {
 	ohci_softc_t *sc = device_get_softc(self);
+	int error;
 
 	/* during module unload there are lots of children leftover */
-	device_delete_children(self);
+	error = device_delete_children(self);
+	if (error != 0) {
+		device_printf(self, "child device failed to detach (%d); "
+		    "refusing controller teardown\n", error);
+		return (error);
+	}
 
 	pci_disable_busmaster(self);