⬢ DragonFlyBSD Kernel Audit
DF-5115 / fix.diff
← back to finding ↓ download raw
--- ips_pci.c	(review copy; against sys/dev/raid/ips/ips_pci.c)
+++ ips_pci.c
@@ -199,16 +199,17 @@ ips_pci_free(ips_softc_t *sc)
 static int
 ips_pci_detach(device_t dev)
 {
 	ips_softc_t *sc;
 
 	DEVICE_PRINTF(1, dev, "detaching ServeRaid\n");
 	sc = (ips_softc_t *)device_get_softc(dev);
 	if (sc->configured) {
-		sc->configured = 0;
 		ips_flush_cache(sc);
 		if (ips_adapter_free(sc))
+			/* detach failed: keep configured=1 so shutdown still
+			 * flushes and a retried detach runs the full unwind
+			 * instead of silently succeeding with a live IRQ. */
 			return EBUSY;
+		sc->configured = 0;
 		ips_pci_free(sc);
 	}
 	return 0;
 }