⬢ DragonFlyBSD Kernel Audit
DF-3677 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/disk/mpt/mpt_cam.c
+++ b/sys/dev/disk/mpt/mpt_cam.c
@@ -3342,6 +3342,14 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
 		} else {
 			xpt_print(ccb->ccb_h.path, "reset device\n");
 		}
+		/*
+		 * XPT_RESET_DEV on the physical-disk bus must map the
+		 * phydisk id to the bus-0 TargetID, exactly like I/O in
+		 * mpt_start(); otherwise the TMF resets the RAID volume
+		 * that happens to share the numeric id.
+		 */
+		if (raid_passthru && mpt_map_physdisk(mpt, ccb, &tgt) != 0) {
+			ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
+			mpt_set_ccb_status(ccb, CAM_DEV_NOT_THERE);
+			xpt_done(ccb);
+			return;
+		}
 		(void) mpt_bus_reset(mpt, tgt, lun, FALSE);
 
 		/*