Skip to contentSkip to conversation

scsi: pm8001: reject non-fatal dump when controller is crashed

PATCH Applied Sagar Biradar 2 participants 3 messages Apr 16 – May 23

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: pm8001: reject non-fatal dump when controller is crashed

From: Kumar Meiyappan <[email protected]>

pm80xx_get_non_fatal_dump() can be called even after the controller has entered a fatal error state. In that case the forensic memory contents are not safe to access for a non-fatal dump request, and attempting to do so can trigger a call trace.

Check controller_fatal_error before reading the non-fatal dump buffer and return -EINVAL when the controller is already in a crashed state.

This prevents non-fatal dump collection from running in an invalid controller state.

---
 drivers/scsi/pm8001/pm80xx_hwi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/scsi/pm8001/pm80xx_hwi.c +7 -0
index 954f307352e6..2c0fa7ab33d2 100644
@@ -401,6 +401,13 @@ ssize_t pm80xx_get_non_fatal_dump(struct device *cdev,
 	char *buf_copy = buf;
 
 	temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr;
+
+	if (pm8001_ha->controller_fatal_error) {
+		pm8001_dbg(pm8001_ha, FAIL,
+			   "non-fatal dump not available in fatal error state\n");
+		return -EINVAL;
+	}
+
 	if (++pm8001_ha->non_fatal_count == 1) {
 		if (pm8001_ha->chip_id == chip_8001) {
 			snprintf(pm8001_ha->forensic_info.data_buf.direct_data,
Signature · 1 line
2.43.0
#1 lore raw

Sagar,

Quoted 4 lines

pm80xx_get_non_fatal_dump() can be called even after the controller has entered a fatal error state. In that case the forensic memory contents are not safe to access for a non-fatal dump request, and attempting to do so can trigger a call trace.

Applied to 7.2/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen
#2 lore raw
In reply to Sagar Biradar
Quoted 9 lines · Sagar Biradar

pm80xx_get_non_fatal_dump() can be called even after the controller has entered a fatal error state. In that case the forensic memory contents are not safe to access for a non-fatal dump request, and attempting to do so can trigger a call trace.

Check controller_fatal_error before reading the non-fatal dump buffer and return -EINVAL when the controller is already in a crashed state.

[...]

Applied to 7.2/scsi-queue, thanks!

[1/1] scsi: pm8001: reject non-fatal dump when controller is crashed

      https://git.kernel.org/mkp/scsi/c/aa3b8f56ef27
Signature · 1 line
Martin K. Petersen