All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chesnokov Gleb <Chesnokov.G@raidix.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: [PATCH 2/2] qla2xxx: Fix missed DMA unmap for aborted cmds
Date: Fri, 15 Apr 2022 12:42:29 +0000	[thread overview]
Message-ID: <AS8PR10MB4952D545F84B6B1DFD39EC1E9DEE9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM> (raw)

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

             reply	other threads:[~2022-04-15 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 12:42 Chesnokov Gleb [this message]
2022-04-19 19:41 ` [PATCH 2/2] qla2xxx: Fix missed DMA unmap for aborted cmds 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8PR10MB4952D545F84B6B1DFD39EC1E9DEE9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM \
    --to=chesnokov.g@raidix.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.