scsi: hpsa: Fix DMA mapping leak on IOACCEL2 reset path

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: c5dfd10641 ("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>
This commit is contained in:
Haoxiang Li
2026-06-23 00:00:28 +08:00
committed by Martin K. Petersen
parent 2c007acf7b
commit e166bafc48

View 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;
}