⬢ DragonFlyBSD Kernel Audit
DF-4092 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/raid/mpr/mpr_mapping.c	2026-09-17 23:11:08.935752656 +0000
+++ b/sys/dev/raid/mpr/mpr_mapping.c	2026-09-17 23:11:44.511296518 +0000
@@ -2294,6 +2301,15 @@
 				    MPI2_DRVMAP0_MAPINFO_SLOT_MASK;
 				num_slots >>= MPI2_DRVMAP0_MAPINFO_SLOT_SHIFT;
 			}
+			if ((dev_idx >= sc->max_devices) ||
+			    (num_slots > (sc->max_devices - dev_idx))) {
+				mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: "
+				    "DPM entry %d dev_idx %d num_slots %d "
+				    "exceeds mapping table size %d; skipping "
+				    "entry\n", __func__, entry_num, dev_idx,
+				    num_slots, sc->max_devices);
+				continue;
+			}
 			enc_idx = sc->num_enc_table_entries;
 			if (enc_idx >= sc->max_enclosures) {
 				mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: "