Skip to contentSkip to conversation

scsi: pm8001: reject firmware update in fatal error state

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 firmware update in fatal error state

From: Kumar Meiyappan <[email protected]>

pm8001_store_update_fw() allows a firmware update request even when the controller has already entered a fatal error state.

Firmware update is not valid once the controller is in that state, and attempting it can lead to a call trace. Reject the request early by checking controller_fatal_error, set the firmware status to FAIL_PARAMETERS, and return -EINVAL.

---
 drivers/scsi/pm8001/pm8001_ctl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/scsi/pm8001/pm8001_ctl.c +8 -0
index cbfda8c04e95..bb38b2d63acb 100644
@@ -826,6 +826,14 @@ static ssize_t pm8001_store_update_fw(struct device *cdev,
 		goto out;
 	}
 
+	if (pm8001_ha->controller_fatal_error) {
+		pm8001_dbg(pm8001_ha, FAIL,
+			   "controller in fatal error state, firmware update rejected\n");
+		pm8001_ha->fw_status = FAIL_PARAMETERS;
+		ret = -EINVAL;
+		goto out;
+	}
+
 	for (i = 0; flash_command_table[i].code != FLASH_CMD_NONE; i++) {
 		if (!memcmp(flash_command_table[i].command,
 				 cmd_ptr, strlen(cmd_ptr))) {
Signature · 1 line
2.43.0
#1 lore raw

Sagar,

Quoted 7 lines

pm8001_store_update_fw() allows a firmware update request even when the controller has already entered a fatal error state.

Firmware update is not valid once the controller is in that state, and attempting it can lead to a call trace. Reject the request early by checking controller_fatal_error, set the firmware status to FAIL_PARAMETERS, and return -EINVAL.

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

pm8001_store_update_fw() allows a firmware update request even when the controller has already entered a fatal error state.

Firmware update is not valid once the controller is in that state, and attempting it can lead to a call trace. Reject the request early by checking controller_fatal_error, set the firmware status to FAIL_PARAMETERS, and return -EINVAL.

[...]

Applied to 7.2/scsi-queue, thanks!

[1/1] scsi: pm8001: reject firmware update in fatal error state

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