public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Check if target mode enabled in case of task management commands
@ 2026-03-26  9:42 Daniil Dulov
  2026-03-26 12:16 ` Dmitry Bogdanov
  0 siblings, 1 reply; 2+ messages in thread
From: Daniil Dulov @ 2026-03-26  9:42 UTC (permalink / raw)
  To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen
  Cc: Daniil Dulov, Dmitry Bogdanov, Tony Battersby, linux-scsi,
	linux-kernel, lvc-project, stable

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
received while target mode is disabled as it is seen in TYPE_TGT_CMD case.

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


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

end of thread, other threads:[~2026-03-26 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox