]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: hpsa: Fix DMA mapping leak on IOACCEL2 reset path
authorHaoxiang Li <haoxiang_li2024@163.com>
Mon, 22 Jun 2026 16:00:28 +0000 (00:00 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 13 Jul 2026 02:21:22 +0000 (22:21 -0400)
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>
Link: https://patch.msgid.link/20260622160028.1240496-1-haoxiang_li2024@163.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hpsa.c

index a1b116cd4723d57cacd043350afd1e8177d15b7e..8edad1830abe4d83770d0ebc83bc519b2e8f6c9d 100644 (file)
@@ -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;
        }