From: Dmitry Bogdanov <d.bogdanov@yadro.com>
To: Daniil Dulov <d.dulov@aladdin.ru>
Cc: Nilesh Javali <njavali@marvell.com>,
<GR-QLogic-Storage-Upstream@marvell.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Tony Battersby <tonyb@cybernetics.com>,
<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<lvc-project@linuxtesting.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] scsi: qla2xxx: Check if target mode enabled in case of task management commands
Date: Thu, 26 Mar 2026 15:16:14 +0300 [thread overview]
Message-ID: <20260326121614.GA31733@yadro.com> (raw)
In-Reply-To: <20260326094249.1366353-1-d.dulov@aladdin.ru>
On Thu, Mar 26, 2026 at 12:42:49PM +0300, Daniil Dulov wrote:
>
> TYPE_TGT_TMCMD are not being skipped now, but tgt_ops are dereferenced
> in qlt_free_ul_cmd() without checking if target mode is enabled. However,
> it is possible that commands requiring target mode to be enabled are
Is is really possible? TYPE_TGT_TMCMD is allocated using tgt_ops
pointer. So at creation time tgt_ops was a valid.
> received while target mode is disabled as it is seen in TYPE_TGT_CMD case.
That condition in TYPE_TGT_CMD is also some legacy leftover.
Race condition when tgt_ops might be get nulled during HBA reset was fixed in
https://lore.kernel.org/all/20210415203554.27890-1-d.bogdanov@yadro.com/
> To fix the issue check if target mode is enabled in TYPE_TGT_TMCMD
> case as well.
>
> Fixes: d46c69a087aa ("scsi: qla2xxx: Clear cmds after chip reset")
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
> ---
> drivers/scsi/qla2xxx/qla_os.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 72b1c28e4dae..e81ef3629aaa 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1890,6 +1890,13 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
> }
> break;
> case TYPE_TGT_TMCMD:
> + if (!vha->hw->tgt.tgt_ops || !tgt ||
> + qla_ini_mode_enabled(vha)) {
> + ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
> + "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n",
> + vha->dpc_flags);
> + continue;
> + }
> /*
> * Currently, only ABTS response gets on the
> * outstanding_cmds[]
> --
> 2.34.1
>
prev parent reply other threads:[~2026-03-26 12:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 9:42 [PATCH] scsi: qla2xxx: Check if target mode enabled in case of task management commands Daniil Dulov
2026-03-26 12:16 ` Dmitry Bogdanov [this message]
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=20260326121614.GA31733@yadro.com \
--to=d.bogdanov@yadro.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=d.dulov@aladdin.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
--cc=stable@vger.kernel.org \
--cc=tonyb@cybernetics.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