From: sashiko-bot@kernel.org
To: "Andrew Stellman" <bugs@stellman-greene.com>
Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 2/2] scsi: target: iscsi: Reject SendTargets=All on Normal sessions
Date: Fri, 04 Dec 2026 06:07:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-249185@kernel.org> (raw)
In-Reply-To: <20261204054735.45435-3-bugs@stellman-greene.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: target: iscsi: empty Text PDU bypasses Normal-session
SendTargets check
--
commit 716dd73bbcd2e3457f8206ab625d6269131c3acb
Author: Andrew Stellman <astellman@stellman-greene.com>
scsi: target: iscsi: Reject SendTargets=All on Normal sessions
This commit rejects SendTargets=All text requests in
iscsit_process_text_cmd() when the session is a Normal session
(SessionType == 0), rather than returning visible target names.
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 7bf4a3b0998fb..eaaf0a4177b04 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -2197,6 +2197,8 @@ iscsit_process_text_cmd(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
> text_ptr = strchr(text_in, '=');
> BUG_ON(!text_ptr);
> if (!strncmp("=All", text_ptr, 5)) {
> + if (!conn->sess->sess_ops->SessionType)
> + goto reject;
> cmd->cmd_flags |= ICF_SENDTARGETS_ALL;
> } else if (!strncmp("=iqn.", text_ptr, 5) ||
> !strncmp("=eui.", text_ptr, 5)) {
[Severity: Medium]
Can an empty Text PDU on a Normal session bypass this SessionType check and
still enumerate all visible targets?
On a Normal session, an initiator can send an immediate ISCSI_OP_NOOP_OUT
with ITT=X and TTT=0xffffffff (which stays on conn->conn_cmd_list with
cmd_flags == 0), followed by an empty ISCSI_OP_TEXT PDU (dlength=0,
ISCSI_FLAG_CMD_FINAL set) using the same ITT=X and any TTT != 0xffffffff.
iscsi_target_rx_opcode() looks up that command solely by ITT via
iscsit_find_cmd_from_itt() without checking that it is a Text command.
iscsit_setup_text_cmd() then sets cmd->text_in_ptr to NULL, so
iscsit_process_text_cmd() jumps to empty_sendtargets and skips this check.
Because iscsit_build_sendtargets_response() only filters g_tiqn_list when
ICF_SENDTARGETS_SINGLE is set and never checks ICF_SENDTARGETS_ALL or
SessionType, it returns every target visible to the Normal session's ACL.
Guarding the !text_in path on Normal sessions when ICF_SENDTARGETS_SINGLE
is not set would close this bypass.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204054735.45435-1-bugs@stellman-greene.com?part=2
prev parent reply other threads:[~2026-12-04 6:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 5:47 [PATCH v2 0/2] scsi: target: iscsi: SendTargets reject fixes Andrew Stellman
2026-12-04 5:47 ` [PATCH v2 1/2] scsi: target: iscsi: Fix leak of a Text command rejected for invalid SendTargets Andrew Stellman
2026-12-04 5:47 ` [PATCH v2 2/2] scsi: target: iscsi: Reject SendTargets=All on Normal sessions Andrew Stellman
2026-12-04 6:07 ` sashiko-bot [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=sashiko-outbox-249185@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bugs@stellman-greene.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=target-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox