mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: pm8001: Fix abort completion status in pm8001_mpi_task_abort_resp()
@ 2026-11-19 17:09 Ian Rogers
  0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-11-19 17:09 UTC (permalink / raw)
  To: Jack Wang, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, llvm, Elkin Cruz, Ian Rogers

In pm8001_mpi_task_abort_resp(), the IO_NOT_VALID branch assigns
TMF_RESP_FUNC_FAILED (enum tmf_resp, 5) to ts->resp (enum
service_response) instead of ts->stat, leaving ts->stat at 0. In
addition, switch (status) has no default case, so any other non-zero
firmware abort failure status leaves both ts->resp and ts->stat at
their zero-initialized values (SAS_TASK_COMPLETE and
SAS_SAM_STAT_GOOD), causing sas_execute_internal_abort() to falsely
treat a failed abort as TMF_RESP_FUNC_COMPLETE.

Set ts->resp = SAS_TASK_COMPLETE and ts->stat = TMF_RESP_FUNC_FAILED
for both IO_NOT_VALID and default failure statuses, matching libsas
and hisi_sas expectations.

Found via Clang -Wassign-enum on an x86_64 allyesconfig build.
Verified by building drivers/scsi/pm8001/pm8001_hwi.o with LLVM=1 W=1
(-Werror) and -Wassign-enum, and with a standalone C reproducer under
ASan/UBSan; not runtime-tested on physical PM8001/PM80xx hardware.

Fixes: dbf9bfe61571 ("[SCSI] pm8001: add SAS/SATA HBA driver")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/scsi/pm8001/pm8001_hwi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 55a01e533fd1..b8c59c152d89 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -3478,7 +3478,12 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 		break;
 	case IO_NOT_VALID:
 		pm8001_dbg(pm8001_ha, FAIL, "IO_NOT_VALID for tag %#x\n", tag);
-		ts->resp = TMF_RESP_FUNC_FAILED;
+		ts->resp = SAS_TASK_COMPLETE;
+		ts->stat = TMF_RESP_FUNC_FAILED;
+		break;
+	default:
+		ts->resp = SAS_TASK_COMPLETE;
+		ts->stat = TMF_RESP_FUNC_FAILED;
 		break;
 	}
 	spin_lock_irqsave(&t->task_state_lock, flags);
-- 
2.56.1.708.g77570a6a1d-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-19 17:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:09 [PATCH] scsi: pm8001: Fix abort completion status in pm8001_mpi_task_abort_resp() Ian Rogers

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

all inboxes | Powered by JetHome®