All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] qla2xxx: Fix missed DMA unmap for aborted cmds
@ 2022-04-15 12:42 Chesnokov Gleb
  2022-04-19 19:41 ` Himanshu Madhani
  2022-05-03  0:50 ` Martin K. Petersen
  0 siblings, 2 replies; 7+ messages in thread
From: Chesnokov Gleb @ 2022-04-15 12:42 UTC (permalink / raw)
  To: linux-scsi

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
  fimware
- 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.

Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 2d30578aebcf..a02235a6a8e9 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3826,6 +3826,9 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd)
 
 	spin_lock_irqsave(&cmd->cmd_lock, flags);
 	if (cmd->aborted) {
+		if (cmd->sg_mapped)
+			qlt_unmap_sg(vha, cmd);
+
 		spin_unlock_irqrestore(&cmd->cmd_lock, flags);
 		/*
 		 * It's normal to see 2 calls in this path:
-- 
2.35.1

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

end of thread, other threads:[~2022-05-04 18:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15 12:42 [PATCH 2/2] qla2xxx: Fix missed DMA unmap for aborted cmds Chesnokov Gleb
2022-04-19 19:41 ` Himanshu Madhani
2022-04-20 14:42   ` Chesnokov Gleb
2022-04-20 19:09     ` Himanshu Madhani
2022-04-25 18:49       ` Chesnokov Gleb
2022-04-27 16:52         ` Himanshu Madhani
2022-05-03  0:50 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.