mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
@ 2026-06-22 16:00 Haoxiang Li
  2026-06-22 18:26 ` Don.Brace
  2026-07-13  2:32 ` Martin K. Petersen
  0 siblings, 2 replies; 5+ messages in thread
From: Haoxiang Li @ 2026-06-22 16:00 UTC (permalink / raw)
  To: James.Bottomley, martin.petersen, david.carroll, justin.lindley,
	scott.teel
  Cc: storagedev, linux-scsi, linux-kernel, Haoxiang Li, stable

If phys_disk->in_reset is set, the function returns directly without
undoing the resources acquired for the command. Add the missing error
cleanup by unmapping the IOACCEL2 SG chain block when needed, unmapping
the SCSI command, and dropping the outstanding IOACCEL command count
before returning.

Fixes: c5dfd106414f ("scsi: hpsa: correct device resets")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/scsi/hpsa.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a1b116cd4723..8edad1830abe 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -5017,6 +5017,10 @@ static int hpsa_scsi_ioaccel2_queue_command(struct ctlr_info *h,
 
 	if (phys_disk->in_reset) {
 		cmd->result = DID_RESET << 16;
+		atomic_dec(&phys_disk->ioaccel_cmds_out);
+		scsi_dma_unmap(cmd);
+		if (use_sg > h->ioaccel_maxsg)
+			hpsa_unmap_ioaccel2_sg_chain_block(h, cp);
 		return -1;
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2026-07-13  2:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 16:00 [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path Haoxiang Li
2026-06-22 18:26 ` Don.Brace
2026-06-24  6:10   ` haoxiang_li2024
2026-06-24 14:06     ` Don.Brace
2026-07-13  2:32 ` 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