Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: target: iscsi: Reject SendTargets=All on Normal sessions
@ 2026-11-30  6:34 Andrew Stellman
  2026-11-30  6:48 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Stellman @ 2026-11-30  6:34 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Mike Christie, target-devel, linux-scsi

From: Andrew Stellman <astellman@stellman-greene.com>

RFC 7143 Appendix C says the SendTargets value All "MUST NOT be
supported on an operational session", but iscsit_process_text_cmd()
accepts it on Normal sessions. With two targets configured with
generate_node_acls=1 and authentication=0, a Normal session to one
target got both target names for SendTargets=All.

Send All on a Normal session to the existing Protocol Error Reject, as
for other invalid SendTargets values. This changes existing behaviour:
a Normal session that sends SendTargets=All no longer gets a target
list. From reading the code, the reject path also ends the connection.

Named-target requests on Normal sessions are unchanged and are not
covered by this patch. In the same setup, a Normal session asking for
the other target still got that target's name and address, in single
runs on head and with the patch.

Tested over TCP in an arm64 KASAN QEMU guest. In an earlier boot, one
Normal-session request on head got both target names for
SendTargets=All. With the patch, ten Normal-session SendTargets=All
requests returned no target name: five got the Reject (reason 0x04)
and five ended with EOF and no response. On head, ten Normal-session
SendTargets=Bogus requests, which go to the same reject label in the
code, got three Rejects and seven EOFs. In earlier boots, single runs
of Discovery All and of a request for the session's own target
returned the same responses on head and with the patch.

The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
Claude Sonnet 5.5, and both were reviewed by me.

Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
Only the TCP path was run; cxgbit calls the same function and was not
tested.

A reproducer is available on request.

 drivers/target/iscsi/iscsi_target.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 03d618cd76721..2dd6aa6ed7ee4 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)) {
-- 
2.53.0


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

end of thread, other threads:[~2026-11-30  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  6:34 [PATCH] scsi: target: iscsi: Reject SendTargets=All on Normal sessions Andrew Stellman
2026-11-30  6:48 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox