From: sashiko-bot@kernel.org
To: "James Sawyer" <james@jamessawyer.co.uk>
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH] scsi: target: iscsi: do not re-add a listed command on Text continuation
Date: Thu, 03 Dec 2026 12:23:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-247713@kernel.org> (raw)
In-Reply-To: <20261203-iscsi-text-double-listadd-v1-1-dff966a10cf0@jamessawyer.co.uk>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: target: iscsi: silent acceptance of non-empty Text
continuations
--
commit fbebc5c9e35a6a434da55856a409f70ce970dbfd
Author: James Sawyer <james@jamessawyer.co.uk>
scsi: target: iscsi: do not re-add a listed command on Text continuation
This commit guards list_add_tail() in iscsit_process_text_cmd() with
list_empty(&cmd->i_conn_node) so a reused Text command on a continuation
request is not linked onto conn->conn_cmd_list a second time.
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 124ff269b8e75..1cbec5f1447fa 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -2226,8 +2226,13 @@ iscsit_process_text_cmd(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
> goto reject;
> }
>
> + /*
> + * A Text Request with TTT != 0xFFFFFFFF reuses the command found by
> + * ITT, which is already on conn_cmd_list. Only link new commands.
> + */
> spin_lock_bh(&conn->cmd_lock);
> - list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list);
> + if (list_empty(&cmd->i_conn_node))
> + list_add_tail(&cmd->i_conn_node, &conn->conn_cmd_list);
> spin_unlock_bh(&conn->cmd_lock);
>
> empty_sendtargets:
[Severity: Medium]
Should iscsit_process_text_cmd() reject a non-empty Text continuation
instead of silently skipping list_add_tail() and proceeding on the reused
cmd?
Multi-sequence SendTargets continuations (hdr->ttt != 0xFFFFFFFF) are only
valid as empty requests taking the empty_sendtargets path. Letting a
continuation with a SendTargets= payload run leaves the reused cmd in an
inconsistent state.
iscsit_setup_text_cmd() resets cmd->targ_xfer_tag to 0xFFFFFFFF, and the
non-empty path never restores hdr->ttt. cmd->read_data_done also retains
the prior offset and skips bytes of the new SendTargets response.
iscsit_process_text_cmd() ORs ICF_SENDTARGETS_ALL or ICF_SENDTARGETS_SINGLE
into cmd->cmd_flags without clearing prior flags. Switching from
SendTargets=iqn.x to SendTargets=All leaves ICF_SENDTARGETS_SINGLE set,
causing iscsit_build_sendtargets_response() to filter targets against "All".
Rejecting non-empty Text continuations before mutating cmd, using
iscsit_add_reject(), would prevent both the list corruption and the
corrupted SendTargets state.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-iscsi-text-double-listadd-v1-1-dff966a10cf0@jamessawyer.co.uk?part=1
prev parent reply other threads:[~2026-12-03 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 11:59 [PATCH] scsi: target: iscsi: do not re-add a listed command on Text continuation James Sawyer
2026-12-03 11:59 ` James Sawyer via B4 Relay
2026-12-03 12:23 ` 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-247713@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=james@jamessawyer.co.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.