From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Quinn Tran <qutran@marvell.com>,
Mike Christie <michael.christie@oracle.com>,
Himanshu Madhani <himanshu.madhani@oracle.com>,
Daniel Wagner <dwagner@suse.de>
Subject: [PATCH 1/7] Revert "qla2xxx: Make sure that aborted commands are freed"
Date: Mon, 15 Mar 2021 20:56:49 -0700 [thread overview]
Message-ID: <20210316035655.2835-2-bvanassche@acm.org> (raw)
In-Reply-To: <20210316035655.2835-1-bvanassche@acm.org>
Calling vha->hw->tgt.tgt_ops->free_cmd() from qlt_xmit_response() is wrong
since the command for which a response is sent must remain valid until the
SCSI target core calls .release_cmd().
Fixes: 0dcec41acb85 ("scsi: qla2xxx: Make sure that aborted commands are freed")
Cc: Quinn Tran <qutran@marvell.com>
Cc: Mike Christie <michael.christie@oracle.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/qla2xxx/qla_target.c | 13 +++++--------
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ----
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index d6366a46283e..5e8b2653e134 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3222,8 +3222,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) ||
(cmd->sess && cmd->sess->deleted)) {
cmd->state = QLA_TGT_STATE_PROCESSED;
- res = 0;
- goto free;
+ return 0;
}
ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018,
@@ -3234,8 +3233,9 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
res = qlt_pre_xmit_response(cmd, &prm, xmit_type, scsi_status,
&full_req_cnt);
- if (unlikely(res != 0))
- goto free;
+ if (unlikely(res != 0)) {
+ return res;
+ }
spin_lock_irqsave(qpair->qp_lock_ptr, flags);
@@ -3255,8 +3255,7 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
vha->flags.online, qla2x00_reset_active(vha),
cmd->reset_count, qpair->chip_reset);
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
- res = 0;
- goto free;
+ return 0;
}
/* Does F/W have an IOCBs for this request */
@@ -3359,8 +3358,6 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type,
qlt_unmap_sg(vha, cmd);
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
-free:
- vha->hw->tgt.tgt_ops->free_cmd(cmd);
return res;
}
EXPORT_SYMBOL(qlt_xmit_response);
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 30959f8da065..15650a0bde09 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -653,7 +653,6 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
{
struct qla_tgt_cmd *cmd = container_of(se_cmd,
struct qla_tgt_cmd, se_cmd);
- struct scsi_qla_host *vha = cmd->vha;
if (cmd->aborted) {
/* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task
@@ -666,7 +665,6 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
cmd->se_cmd.transport_state,
cmd->se_cmd.t_state,
cmd->se_cmd.se_cmd_flags);
- vha->hw->tgt.tgt_ops->free_cmd(cmd);
return 0;
}
@@ -694,7 +692,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
{
struct qla_tgt_cmd *cmd = container_of(se_cmd,
struct qla_tgt_cmd, se_cmd);
- struct scsi_qla_host *vha = cmd->vha;
int xmit_type = QLA_TGT_XMIT_STATUS;
if (cmd->aborted) {
@@ -708,7 +705,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
cmd, kref_read(&cmd->se_cmd.cmd_kref),
cmd->se_cmd.transport_state, cmd->se_cmd.t_state,
cmd->se_cmd.se_cmd_flags);
- vha->hw->tgt.tgt_ops->free_cmd(cmd);
return 0;
}
cmd->bufflen = se_cmd->data_length;
next prev parent reply other threads:[~2021-03-16 3:57 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 3:56 [PATCH 0/7] qla2xxx patches for kernel v5.12 and v5.13 Bart Van Assche
2021-03-16 3:56 ` Bart Van Assche [this message]
2021-03-16 8:25 ` [PATCH 1/7] Revert "qla2xxx: Make sure that aborted commands are freed" Daniel Wagner
2021-03-16 20:36 ` Bart Van Assche
2021-03-17 8:56 ` Daniel Wagner
2021-03-16 16:25 ` Himanshu Madhani
2021-03-16 20:28 ` Bart Van Assche
2021-03-17 17:37 ` Himanshu Madhani
2021-03-16 3:56 ` [PATCH 2/7] qla2xxx: Constify struct qla_tgt_func_tmpl Bart Van Assche
2021-03-16 8:25 ` Daniel Wagner
2021-03-16 16:23 ` Himanshu Madhani
2021-03-16 3:56 ` [PATCH 3/7] qla2xxx: Fix endianness annotations Bart Van Assche
2021-03-16 8:32 ` Daniel Wagner
2021-03-16 16:27 ` Himanshu Madhani
2021-03-16 3:56 ` [PATCH 4/7] qla2xxx: qla82xx_pinit_from_rom(): Initialize 'n' before using it Bart Van Assche
2021-03-16 8:36 ` Daniel Wagner
2021-03-16 20:39 ` Bart Van Assche
2021-03-16 16:27 ` Himanshu Madhani
2021-03-16 3:56 ` [PATCH 5/7] qla2xxx: Suppress Coverity complaints about dseg_r* Bart Van Assche
2021-03-16 8:37 ` Daniel Wagner
2021-03-16 16:28 ` Himanshu Madhani
2021-03-16 3:56 ` [PATCH 6/7] qla2xxx: Simplify qla8044_minidump_process_control() Bart Van Assche
2021-03-16 8:45 ` Daniel Wagner
2021-03-16 16:29 ` Himanshu Madhani
2021-03-16 3:56 ` [PATCH 7/7] qla2xxx: Always check the return value of qla24xx_get_isp_stats() Bart Van Assche
2021-03-16 8:48 ` Daniel Wagner
2021-03-16 20:40 ` Bart Van Assche
2021-03-16 16:30 ` Himanshu Madhani
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=20210316035655.2835-2-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=dwagner@suse.de \
--cc=himanshu.madhani@oracle.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=qutran@marvell.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox