DragonFlyBSD Kernel Audit
DF-1821 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/vinum/vinumraid5.c b/sys/dev/raid/vinum/vinumraid5.c
--- a/sys/dev/raid/vinum/vinumraid5.c
+++ b/sys/dev/raid/vinum/vinumraid5.c
@@ -138,6 +138,11 @@
     plex = &PLEX[plexno];				    /* point to the plex */
 
 
+
+    /* RAID-4/5 needs at least one data + one parity subdisk; otherwise the
+     * (subdisks - 1) divisor below would divide by zero. */
+    if (plex->subdisks < 2)
+	return REQUEST_EOF;
     while (*diskaddr < diskend) {			    /* until we get it all sorted out */
 	if (*diskaddr >= plex->length)			    /* beyond the end of the plex */
 	    return REQUEST_EOF;				    /* can't continue */