[PATCH v4 0/4] isert: the commands the target core allocates itself
From: Yehyeong Lee
Date: Thu Nov 19 2026 - 08:17:18 EST
Link: https://lore.kernel.org/all/20261118211503.2526705-1-yhlee@xxxxxxxxxxxxxxxxxx/ (v3)
Link: https://lore.kernel.org/all/20261118113905.2361969-1-yhlee@xxxxxxxxxxxxxxxxxx/ (v2)
Link: https://lore.kernel.org/all/20261116101108.1650132-1-yhlee@xxxxxxxxxxxxxxxxxx/ (v1)
Changes since v3: 1/4 is replaced again. The review of v3 1/4 is right.
iscsit_add_nopin() publishes the command before it queues the send and the
tags are sequential, so a guessed answer can arrive while the NOP-In is
still only queued; the lookup then queues ISTATE_REMOVE ahead of the send
and the tx thread sends from a command it has freed, and clearing the tag
before the header is built would also put 0xFFFFFFFF on the wire. That
window is in the base tree too. 1/4 now marks the command with
ISTATE_SENT_NOPIN_WANT_RESPONSE under cmd_lock, after
iscsit_build_nopin_rsp() and before the PDU can reach the wire, and
requires that mark. 2/4 to 4/4 are unchanged.
Answering the review of v1 1/2 needs two target-core patches, so there are
four. 1/4 and 2/4 are drivers/target/iscsi, 3/4 and 4/4 are
drivers/infiniband/ulp/isert, and 3/4 depends on 1/4: it lets a Reject the
core allocated reach the wire, which without 1/4 is a double free.
1/4 is not about iSER. iscsit_find_cmd_from_ttt() matches on
targ_xfer_tag alone and leaves the command on conn_cmd_list, so a NOP-Out
with a reserved ITT and TTT 0 is given the Reject the core allocated, and
a second with the same TTT is given a NOP-In again - both double release.
2/4 keeps the unsolicited NOP-In off iSER. The transport check in
iscsi_post_login_start_timers() runs once, at login, while
iscsit_process_nop_out() and iscsit_na_nopin_timeout() arm the timer again
later, so it moves into __iscsit_start_nopin_timer(), which all three go
through; isert releases such a command on its Send completion.
3/4 is v1's 1/2 with the fix generalised. struct isert_cmd is all zero for
a command the core allocated, so the back pointers are filled in where the
core hands one over, in isert_immediate_queue() and isert_response_queue().
4/4 is v1's 2/2, unchanged.
Measured with KASAN, one fresh boot per cell, arms alternating. On an iSER
portal over soft-RoCE, 3 boots per cell on the finished series and 2 on the
stages; the base column is the v3 round, whose binary is unchanged:
base 1/4 1-2/4 1-4/4
Reject + NOP-Out, TTT 0 Oops Oops Oops clean
the same two PDUs paced Oops Oops Oops clean
nopin_timeout 0 then 3 Oops - - clean
200 Data-Outs, nonexistent ITT 128 - - 200
one Data-Out over TRDSL Oops - - clean
login/WRITE/READ/logout - - - 10/10
Where a cell oopsed, the reports that follow come from the teardown of the
killed thread and are the same set at base. All 18 are clean on 1-4/4.
On plain iscsi_tcp, base against the whole series, 5 cells for the first
row and 3 for the others: two NOP-Outs answering one real NOP-In are both
taken on base and the second refused with the series; 20 Data-Out and
NOP-Out(TTT 0) pairs in one write give 20 KASAN reports per cell on base
and 0 with the series; a legitimate answer still works on both. With the
add_nopin() window widened by a test-only delay, a guessed answer is taken
in 17 of 17 attempts on base and refused in 19 of 19 with 1/4.
Yehyeong Lee (4):
scsi: target: iscsi: retire an unsolicited NOP-In only once
scsi: target: iscsi: do not arm the nopin timer on an iSER connection
IB/isert: finish a Reject the target core allocated itself
IB/isert: do not leak the receive descriptor of a dropped Data-Out
drivers/infiniband/ulp/isert/ib_isert.c | 41 ++++++++++++-----
drivers/target/iscsi/iscsi_target.c | 54 ++++++++++++++++++++---
drivers/target/iscsi/iscsi_target_login.c | 5 ---
drivers/target/iscsi/iscsi_target_util.c | 10 +++++
4 files changed, 88 insertions(+), 22 deletions(-)
--
2.43.0