From: sashiko-bot@kernel.org
To: "Yehyeong Lee" <yhlee@isslab.korea.ac.kr>
Cc: linux-rdma@vger.kernel.org, target-devel@vger.kernel.org,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 1/4] scsi: target: iscsi: match a NOP-In by opcode as well as by tag
Date: Wed, 18 Nov 2026 12:07:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-220874@kernel.org> (raw)
In-Reply-To: <20261118113905.2361969-2-yhlee@isslab.korea.ac.kr>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Critical] scsi: target: iscsi: double free of NOP-In in
iscsit_process_nop_out()
--
commit 4b724f8430caaec9358e8c9a8789de674c7d8d78
Author: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
scsi: target: iscsi: match a NOP-In by opcode as well as by tag
This commit updates iscsit_find_cmd_from_ttt() to match commands by both
iSCSI opcode and Target Transfer Tag so that NOP-Out and Data ACK SNACK
handlers only match the command type they expect.
Link: https://lore.kernel.org/all/1437516477-30554-4-git-send-email-sbaugh@catern.com/
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 124ff269b8e75..2762a60ec3b33 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -1821,7 +1821,8 @@ int iscsit_process_nop_out(struct iscsit_conn *conn, struct iscsit_cmd *cmd,
> * This was a response to a unsolicited NOPIN ping.
> */
> if (hdr->ttt != cpu_to_be32(0xFFFFFFFF)) {
> - cmd_p = iscsit_find_cmd_from_ttt(conn, be32_to_cpu(hdr->ttt));
> + cmd_p = iscsit_find_cmd_from_ttt(conn, be32_to_cpu(hdr->ttt),
> + ISCSI_OP_NOOP_IN);
> if (!cmd_p)
> return -EINVAL;
[Severity: Critical]
Can back-to-back NOP-Out PDUs carrying a NOP-In's TTT still double free
cmd_p?
An unsolicited NOP-In queued by iscsit_add_nopin() sits on
conn->conn_cmd_list with no se_cmd, and iscsit_find_cmd_from_ttt() returns
it without removing it from conn->conn_cmd_list or invalidating its
targ_xfer_tag under conn->cmd_lock:
rx thread tx thread
iscsit_process_nop_out()
cmd_p = iscsit_find_cmd_from_ttt(...)
cmd_p->i_state = ISTATE_REMOVE
iscsit_add_cmd_to_immediate_queue(cmd_p, ...)
iscsit_process_nop_out()
cmd_p = iscsit_find_cmd_from_ttt(...)
cmd_p->i_state = ISTATE_REMOVE
iscsit_add_cmd_to_immediate_queue(cmd_p, ...)
iscsit_immediate_queue()
list_del_init(&cmd->i_conn_node)
iscsit_free_cmd(cmd, false)
iscsit_immediate_queue()
list_del_init(&cmd->i_conn_node)
iscsit_free_cmd(cmd, false)
<-- double free
Because conn->conn_cmd_list is only updated when the tx thread runs
iscsit_immediate_queue(), sending two NOP-Out responses with the NOP-In's
TTT in one write queues the same ISCSI_OP_NOOP_IN command with
ISTATE_REMOVE twice, causing iscsit_release_cmd() to double free the
command and its session tag (or corrupt a newly allocated command if the
tag was reused in between).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118113905.2361969-1-yhlee@isslab.korea.ac.kr?part=1
next prev parent reply other threads:[~2026-11-18 12:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 11:39 [PATCH v2 0/4] isert: the commands the target core allocates itself Yehyeong Lee
2026-11-18 11:39 ` [PATCH v2 1/4] scsi: target: iscsi: match a NOP-In by opcode as well as by tag Yehyeong Lee
2026-11-18 12:07 ` sashiko-bot [this message]
2026-11-18 11:39 ` [PATCH v2 2/4] scsi: target: iscsi: do not arm the nopin timer on an iSER connection Yehyeong Lee
2026-11-18 11:39 ` [PATCH v2 3/4] IB/isert: finish a Reject the target core allocated itself Yehyeong Lee
2026-11-18 11:39 ` [PATCH v2 4/4] IB/isert: do not leak the receive descriptor of a dropped Data-Out Yehyeong Lee
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-220874@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=target-devel@vger.kernel.org \
--cc=yhlee@isslab.korea.ac.kr \
/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