Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: pm8001: reject non-fatal dump when controller is crashed
@ 2026-04-16 15:46 Sagar Biradar
  2026-05-15  2:10 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Sagar Biradar @ 2026-04-16 15:46 UTC (permalink / raw)
  To: Martin K . Petersen, James Bottomley, Jack Wang
  Cc: linux-scsi, stable, Brian King, Don Brace, Raja VS,
	Kumar Meiyappan, Abhinav Kuchibhotla, Uday kumar Bagam,
	Advait Churi, Sagar Biradar

From: Kumar Meiyappan <kumar.meiyappan@microchip.com>

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.

Signed-off-by: Kumar Meiyappan <kumar.meiyappan@microchip.com>
Signed-off-by: Sagar Biradar <sagar.biradar@microchip.com>
---
 drivers/scsi/pm8001/pm80xx_hwi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index 954f307352e6..2c0fa7ab33d2 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -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,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: pm8001: reject non-fatal dump when controller is crashed
  2026-04-16 15:46 [PATCH] scsi: pm8001: reject non-fatal dump when controller is crashed Sagar Biradar
@ 2026-05-15  2:10 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2026-05-15  2:10 UTC (permalink / raw)
  To: Sagar Biradar
  Cc: Martin K . Petersen, James Bottomley, Jack Wang, linux-scsi,
	stable, Brian King, Don Brace, Raja VS, Kumar Meiyappan,
	Abhinav Kuchibhotla, Uday kumar Bagam, Advait Churi


Sagar,

> 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!

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-15  2:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16 15:46 [PATCH] scsi: pm8001: reject non-fatal dump when controller is crashed Sagar Biradar
2026-05-15  2:10 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox