[PATCH v2 2/4] scsi: target: iscsi: do not arm the nopin timer on an iSER connection

From: Yehyeong Lee

Date: Wed Nov 18 2026 - 06:39:37 EST


iscsi_post_login_start_timers() does not arm the nopin timer for
ISCSI_INFINIBAND, under a FIXME that says unsolicited NOP-In is not
supported there. It is the only place that looks at the transport, and it
runs once, at login. Two other sites arm the same timer for a connection
that is already logged in: iscsit_process_nop_out() after a NOP-Out
response, and iscsit_na_nopin_timeout() for every logged-in connection of
an ACL whose nopin_timeout is written from 0 to a non-zero value.

So an iSER connection does get unsolicited NOP-Ins, and iscsit_add_nopin()
builds them from a command of its own. Writing nopin_timeout 0 and then 3
on the ACL of a logged-in iSER session kills the target on unmodified
mainline: struct isert_cmd is all zero for such a command, and
isert_put_nopin() hands the NULL receive descriptor to isert_post_recv(),
which dereferences it. That part is a bug in isert and is fixed two
patches on.

[ 7.760642] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000484: 0000 [#1] SMP KASAN NOPTI
[ 7.763622] KASAN: probably user-memory-access in range [0x0000000000002420-0x0000000000002427]
[ 7.765384] CPU: 0 UID: 0 PID: 175 Comm: iscsi_ttx Not tainted 7.4.0-rc2-RJ7A-00716-g23c62304dde2 #15 PREEMPT(lazy)
[ 7.767152] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 7.768831] RIP: 0010:isert_post_recv+0x98/0x210
[ 7.769516] Code: 89 f8 48 c7 44 24 48 00 00 00 00 48 c7 44 24 50 00 00 00 00 48 c1 e8 03 48 c7 44 24 58 00 00 00 00 48 c7 44 24 60 00 00 00 00 <0f> b6 04 10 84 c0 74 06 0f 8e 2c 01 00 00 31 ed 80 be 20 24 00 00
[ 7.771842] RSP: 0018:ffff888104f67c10 EFLAGS: 00010206
[ 7.772484] RAX: 0000000000000484 RBX: 1ffff110209ecf83 RCX: 0000000000000000
[ 7.773332] RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000002420
[ 7.774172] RBP: ffff888104f8c980 R08: 00000000000002bc R09: 0000000000000001
[ 7.775024] R10: ffff888104f26447 R11: 000000005436c6f6 R12: ffff888104af8000
[ 7.775843] R13: ffff888104af8000 R14: ffff888104b55000 R15: ffff888104f8c500
[ 7.776657] FS: 0000000000000000(0000) GS:ffff88816105d000(0000) knlGS:0000000000000000
[ 7.777558] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 7.778220] CR2: 00007f221cf10000 CR3: 0000000104e1f005 CR4: 0000000000770ef0
[ 7.779031] PKRU: 55555554
[ 7.779360] Call Trace:
[ 7.779654] <TASK>
[ 7.779916] ? __pfx_isert_post_recv+0x10/0x10
[ 7.780460] isert_post_response+0x85/0x1b0
[ 7.780928] ? __pfx_isert_post_response+0x10/0x10
[ 7.781455] ? isert_put_nopin+0xcb/0x3d0
[ 7.781898] iscsi_target_tx_thread+0x33c/0x6f0
[ 7.782411] ? __pfx_iscsi_target_tx_thread+0x10/0x10
[ 7.782983] ? _raw_spin_lock_irq+0x10/0xe0
[ 7.783461] ? __pfx_autoremove_wake_function+0x10/0x10
[ 7.784043] ? __pfx_kthread_affine_node+0x10/0x10
[ 7.784574] ? __kthread_parkme+0x88/0x170
[ 7.785024] ? __pfx_iscsi_target_tx_thread+0x10/0x10
[ 7.785577] ? __pfx_iscsi_target_tx_thread+0x10/0x10
[ 7.786120] kthread+0x2c8/0x3b0
[ 7.786487] ? recalc_sigpending+0x15c/0x1e0
[ 7.786980] ? __pfx_kthread+0x10/0x10
[ 7.787404] ret_from_fork+0x36e/0x5a0
[ 7.787831] ? __pfx_ret_from_fork+0x10/0x10
[ 7.788303] ? __switch_to+0x572/0xdc0
[ 7.788725] ? __pfx_kthread+0x10/0x10
[ 7.789137] ret_from_fork_asm+0x1a/0x30
[ 7.789573] </TASK>
[ 7.789824] Modules linked in:
[ 7.790190] ---[ end trace 0000000000000000 ]---

What cannot be fixed there is the answer. isert releases a command when
its Send completes - isert_send_done() ends in isert_put_cmd() for every
state it does not special-case - so by the time the initiator's NOP-Out
arrives the NOP-In is no longer on conn->conn_cmd_list, and
iscsit_find_cmd_from_ttt() cannot match it:

Unable to locate TTT: 0x00000000 on CID: 0
Did not receive response to NOPIN on CID: 0, failing connection for
I_T Nexus iqn.2026-07.repro:init,...

The nopin response timer then expires and the connection is reinstated,
once per nopin_timeout, in 5 boots out of 5. Keeping the command alive
across the Send completion is isert's business and is more than a
dereference fix, so until it is done, make the transport check hold for
the whole life of the connection instead of only at login: move it into
__iscsit_start_nopin_timer(), which all three arming sites go through.

David Jeffery's 2022 series went the other way - it wanted the unsolicited
NOP-In on isert, for a different reason, and did the rest of the work for
it - but it was not applied, and even that series does not cover the
want_response case the nopin timer produces.

Link: https://lore.kernel.org/all/20220311175713.2344960-1-djeffery@xxxxxxxxxx/
Fixes: b8d26b3be8b3 ("iser-target: Add iSCSI Extensions for RDMA (iSER) target driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yehyeong Lee <yhlee@xxxxxxxxxxxxxxxxxx>
---
drivers/target/iscsi/iscsi_target_login.c | 5 -----
drivers/target/iscsi/iscsi_target_util.c | 10 ++++++++++
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index c282b6a7029684..08da40534d2e77 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -587,11 +587,6 @@ int iscsi_login_post_auth_non_zero_tsih(
static void iscsi_post_login_start_timers(struct iscsit_conn *conn)
{
struct iscsit_session *sess = conn->sess;
- /*
- * FIXME: Unsolicited NopIN support for ISER
- */
- if (conn->conn_transport->transport_type == ISCSI_INFINIBAND)
- return;

if (!sess->sess_ops->SessionType)
iscsit_start_nopin_timer(conn);
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 9ee1b5fcf5059f..fa585b01bcdab6 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -964,6 +964,16 @@ void __iscsit_start_nopin_timer(struct iscsit_conn *conn)

lockdep_assert_held(&conn->nopin_timer_lock);

+ /*
+ * FIXME: Unsolicited NopIN support for ISER
+ *
+ * iscsit_add_nopin() builds the NOP-In from a command the core
+ * allocated itself, and isert releases such a command on the send
+ * completion, so the answer could not be matched back to it.
+ */
+ if (conn->conn_transport->transport_type == ISCSI_INFINIBAND)
+ return;
+
/*
* NOPIN timeout is disabled.
*/
--
2.43.0