DragonFlyBSD Kernel Audit
DF-1193 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/ciss/ciss.c b/sys/dev/raid/ciss/ciss.c
--- a/sys/dev/raid/ciss/ciss.c
+++ b/sys/dev/raid/ciss/ciss.c
@@ -1190,6 +1190,17 @@
 	goto out;
     }
 
+    /*
+     * CISS_BIG_MAP_BUS/TARGET (cissreg.h) divide by
+     * sc->ciss_id->drives_per_scsi_bus.  Reject a controller that
+     * reports 0 here so the macros cannot trigger a #DE (DF-1193).
+     */
+    if (sc->ciss_id->drives_per_scsi_bus == 0) {
+	ciss_printf(sc, "adapter reports drives_per_scsi_bus=0\n");
+	error = ENXIO;
+	goto out;
+    }
+
 #if 0
     /* XXX later revisions may not need this */
     sc->ciss_flags |= CISS_FLAG_FAKE_SYNCH;