From: Sagar Biradar <sagar.biradar@microchip.com>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>, <stable@vger.kernel.org>,
"Brian King" <brking@linux.vnet.ibm.com>,
Don Brace <don.brace@microchip.com>,
"Raja VS" <raja.vs@microchip.com>,
Kumar Meiyappan <kumar.meiyappan@microchip.com>,
Abhinav Kuchibhotla <abhinav.kuchibhotla@microchip.com>,
Uday kumar Bagam <udaykumar.bagam@microchip.com>,
Advait Churi <advait.churi@microchip.com>,
Sagar Biradar <sagar.biradar@microchip.com>
Subject: [PATCH] scsi: pm8001: reject non-fatal dump when controller is crashed
Date: Thu, 16 Apr 2026 15:46:50 +0000 [thread overview]
Message-ID: <20260416154650.415624-1-sagar.biradar@microchip.com> (raw)
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
next reply other threads:[~2026-04-16 16:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 15:46 Sagar Biradar [this message]
2026-05-15 2:10 ` [PATCH] scsi: pm8001: reject non-fatal dump when controller is crashed Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260416154650.415624-1-sagar.biradar@microchip.com \
--to=sagar.biradar@microchip.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=abhinav.kuchibhotla@microchip.com \
--cc=advait.churi@microchip.com \
--cc=brking@linux.vnet.ibm.com \
--cc=don.brace@microchip.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=kumar.meiyappan@microchip.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=raja.vs@microchip.com \
--cc=stable@vger.kernel.org \
--cc=udaykumar.bagam@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox