* [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
* Re: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
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-07-13 2:32 ` Martin K. Petersen
1 sibling, 1 reply; 5+ messages in thread
From: Don.Brace @ 2026-06-22 18:26 UTC (permalink / raw)
To: haoxiang_li2024, James.Bottomley, martin.petersen, david.carroll,
justin.lindley, scott.teel
Cc: storagedev, linux-scsi, linux-kernel, stable
________________________________________
From: Haoxiang Li <haoxiang_li2024@163.com>
Sent: Monday, June 22, 2026 11:00 AM
To: James.Bottomley@HansenPartnership.com <James.Bottomley@HansenPartnership.com>; martin.petersen@oracle.com <martin.petersen@oracle.com>; david.carroll@microsemi.com <david.carroll@microsemi.com>; justin.lindley@microsemi.com <justin.lindley@microsemi.com>; scott.teel@microsemi.com <scott.teel@microsemi.com>
Cc: storagedev <storagedev@microchip.com>; linux-scsi@vger.kernel.org <linux-scsi@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; Haoxiang Li <haoxiang_li2024@163.com>; stable@vger.kernel.org <stable@vger.kernel.org>
Subject: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
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>
Acked-by: Don Brace <don.brace@microchip.com
Thanks for your patch. Can fix potential performance issues with devices undergoing resets.
What about another patch for when call to hpsa_map_ioaccel2_sg_chain_block() fails?
---
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
* Re:Re: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
2026-06-22 18:26 ` Don.Brace
@ 2026-06-24 6:10 ` haoxiang_li2024
2026-06-24 14:06 ` Don.Brace
0 siblings, 1 reply; 5+ messages in thread
From: haoxiang_li2024 @ 2026-06-24 6:10 UTC (permalink / raw)
To: Don.Brace
Cc: James.Bottomley, martin.petersen, david.carroll, justin.lindley,
scott.teel, storagedev, linux-scsi, linux-kernel, stable
On 2026-06-23 02:26:42,Don.Brace@microchip.com wrote:
>________________________________________
>From: Haoxiang Li <haoxiang_li2024@163.com>
>Sent: Monday, June 22, 2026 11:00 AM
>To: James.Bottomley@HansenPartnership.com <James.Bottomley@HansenPartnership.com>; martin.petersen@oracle.com <martin.petersen@oracle.com>; david.carroll@microsemi.com <david.carroll@microsemi.com>; justin.lindley@microsemi.com <justin.lindley@microsemi.com>; scott.teel@microsemi.com <scott.teel@microsemi.com>
>Cc: storagedev <storagedev@microchip.com>; linux-scsi@vger.kernel.org <linux-scsi@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; Haoxiang Li <haoxiang_li2024@163.com>; stable@vger.kernel.org <stable@vger.kernel.org>
>Subject: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
>
>EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
>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>
>
>Acked-by: Don Brace <don.brace@microchip.com
>Thanks for your patch. Can fix potential performance issues with devices undergoing resets.
>What about another patch for when call to hpsa_map_ioaccel2_sg_chain_block() fails?
>
>
Thanks for your review! I checked the hpsa_map_ioaccel2_sg_chain_block() failure path. It
already decrements ioaccel_cmds_out and calls scsi_dma_unmap(cmd). I think this patch
is enough?
>---
> 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
Thanks,
Haoxiang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re:Re: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
2026-06-24 6:10 ` haoxiang_li2024
@ 2026-06-24 14:06 ` Don.Brace
0 siblings, 0 replies; 5+ messages in thread
From: Don.Brace @ 2026-06-24 14:06 UTC (permalink / raw)
To: haoxiang_li2024
Cc: James.Bottomley, martin.petersen, david.carroll, justin.lindley,
scott.teel, storagedev, linux-scsi, linux-kernel, stable
________________________________________
From: haoxiang_li2024 <haoxiang_li2024@163.com>
Sent: Wednesday, June 24, 2026 1:10 AM
To: Don Brace - C33706 <Don.Brace@microchip.com>
Cc: James.Bottomley@HansenPartnership.com <James.Bottomley@HansenPartnership.com>; martin.petersen@oracle.com <martin.petersen@oracle.com>; david.carroll@microsemi.com <david.carroll@microsemi.com>; justin.lindley@microsemi.com <justin.lindley@microsemi.com>; scott.teel@microsemi.com <scott.teel@microsemi.com>; storagedev <storagedev@microchip.com>; linux-scsi@vger.kernel.org <linux-scsi@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; stable@vger.kernel.org <stable@vger.kernel.org>
Subject: Re:Re: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
On 2026-06-23 02:26:42,Don.Brace@microchip.com wrote:
>Fixes: c5dfd106414f ("scsi: hpsa: correct device resets")
>Cc: stable@vger.kernel.org
>Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
>
>Acked-by: Don Brace <don.brace@microchip.com
>Thanks for your patch. Can fix potential performance issues with devices undergoing resets.
>What about another patch for when call to hpsa_map_ioaccel2_sg_chain_block() fails?
>
>
Thanks for your review! I checked the hpsa_map_ioaccel2_sg_chain_block() failure path. It
already decrements ioaccel_cmds_out and calls scsi_dma_unmap(cmd). I think this patch
is enough?
Yes, good enough.
Thanks for checking.
>---
> 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
Thanks,
Haoxiang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
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-07-13 2:32 ` Martin K. Petersen
1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2026-07-13 2:32 UTC (permalink / raw)
To: James.Bottomley, david.carroll, justin.lindley, scott.teel, Haoxiang Li
Cc: Martin K . Petersen, storagedev, linux-scsi, linux-kernel, stable
On Tue, 23 Jun 2026 00:00:28 +0800, Haoxiang Li wrote:
> 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.
>
>
> [...]
Applied to 7.2/scsi-fixes, thanks!
[1/1] scsi: hpsa: fix DMA mapping leak on IOACCEL2 reset path
https://git.kernel.org/mkp/scsi/c/e166bafc483e
--
Martin K. Petersen
^ 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