Skip to content

Commit 26f9ce5

Browse files
lnocturnomartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix missed DMA unmap for aborted commands
Aborting commands that have already been sent to the firmware can cause BUG in qlt_free_cmd(): BUG_ON(cmd->sg_mapped) For instance: - Command passes rdx_to_xfer state, maps sgl, sends to the firmware - Reset occurs, qla2xxx performs ISP error recovery, aborts the command - Target stack calls qlt_abort_cmd() and then qlt_free_cmd() - BUG_ON(cmd->sg_mapped) in qlt_free_cmd() occurs because sgl was not unmapped Thus, unmap sgl in qlt_abort_cmd() for commands with the aborted flag set. Link: https://lore.kernel.org/r/AS8PR10MB4952D545F84B6B1DFD39EC1E9DEE9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Gleb Chesnokov <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6056a92 commit 26f9ce5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3826,6 +3826,9 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd)
38263826

38273827
spin_lock_irqsave(&cmd->cmd_lock, flags);
38283828
if (cmd->aborted) {
3829+
if (cmd->sg_mapped)
3830+
qlt_unmap_sg(vha, cmd);
3831+
38293832
spin_unlock_irqrestore(&cmd->cmd_lock, flags);
38303833
/*
38313834
* It's normal to see 2 calls in this path:

0 commit comments

Comments
 (0)