All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] isert: the commands the target core allocates itself
@ 2026-11-18 21:14 Yehyeong Lee
  2026-11-18 21:15 ` [PATCH v3 1/4] scsi: target: iscsi: retire an unsolicited NOP-In only once Yehyeong Lee
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Yehyeong Lee @ 2026-11-18 21:14 UTC (permalink / raw)
  To: sagi, jgg, leon, mkp; +Cc: linux-rdma, target-devel, linux-scsi, linux-kernel

Link: https://lore.kernel.org/all/20261118113905.2361969-1-yhlee@isslab.korea.ac.kr/ (v2)
Link: https://lore.kernel.org/all/20261116101108.1650132-1-yhlee@isslab.korea.ac.kr/ (v1)

Changes since v2: 1/4 is replaced.  Comparing the opcode inside
iscsit_find_cmd_from_ttt() stopped a Reject being taken for a NOP-In, but
not two NOP-Outs being given the same real NOP-In, which queues it for
removal twice.  1/4 now gives the NOP-Out path its own lookup that takes
the command under conn->cmd_lock and clears its tag, so only the first
answer gets it, and it leaves iscsit_find_cmd_from_ttt() and its Data ACK
SNACK caller alone.  2/4 to 4/4 are unchanged.

Answering the review of v1 1/2 needs two patches in the target core, so v3
has four.  1/4 and 2/4 are drivers/target/iscsi and 3/4 and 4/4 are
drivers/infiniband/ulp/isert, but 3/4 depends on 1/4: it lets a Reject the
core allocated reach the wire, and without 1/4 first that turns a NULL
dereference in the base tree into a double free.

1/4 is not about iSER.  iscsit_find_cmd_from_ttt() matches a command by
targ_xfer_tag alone and leaves it on conn_cmd_list, so a NOP-Out with a
reserved ITT and TTT 0 is given the Reject the core allocated, which
carries TTT 0 and is still waiting to be sent, and a second NOP-Out with
the same TTT is given it again - either shape ends in a double release.
Both are reachable on plain iscsi_tcp one PDU after login.

2/4 keeps the unsolicited NOP-In off iSER.  The transport check in
iscsi_post_login_start_timers() runs once, at login, and
iscsit_process_nop_out() and iscsit_na_nopin_timeout() arm the nopin timer
again on a connection that is already logged in, so it moves into
__iscsit_start_nopin_timer(), which all three go through.  Gating it is the
fix rather than only the dereference because isert releases a command on
its Send completion, so the answer to a NOP-In cannot be matched to it.

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(),
which also covers the ISTATE_REMOVE the review pointed at.

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 intermediate stages:

                                 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

No cell at any stage produced a double free, and the finished series is
KASAN-clean.  Where a cell oopsed, the use-after-free reports that follow
come from the teardown of the killed thread and are the same set at base.

On plain iscsi_tcp: two NOP-Outs answering one real NOP-In are both taken
on base and the second is refused with 1/4, 5 cells each; 20 Data-Out and
NOP-Out(TTT 0) pairs in one write give 19 or 20 KASAN reports per cell on
base and 0 with 1/4, and one legitimate answer still works on both; 3
cells each.

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       | 34 +++++++++++++++++--
 drivers/target/iscsi/iscsi_target_login.c |  5 ---
 drivers/target/iscsi/iscsi_target_util.c  | 10 ++++++
 4 files changed, 72 insertions(+), 18 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-11-19 13:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 21:14 [PATCH v3 0/4] isert: the commands the target core allocates itself Yehyeong Lee
2026-11-18 21:15 ` [PATCH v3 1/4] scsi: target: iscsi: retire an unsolicited NOP-In only once Yehyeong Lee
2026-11-18 21:29   ` sashiko-bot
2026-11-18 21:15 ` [PATCH v3 2/4] scsi: target: iscsi: do not arm the nopin timer on an iSER connection Yehyeong Lee
2026-11-18 21:25   ` sashiko-bot
2026-11-18 21:15 ` [PATCH v3 3/4] IB/isert: finish a Reject the target core allocated itself Yehyeong Lee
2026-11-18 21:23   ` sashiko-bot
2026-11-18 21:15 ` [PATCH v3 4/4] IB/isert: do not leak the receive descriptor of a dropped Data-Out Yehyeong Lee
2026-11-18 21:28   ` sashiko-bot
2026-11-19 13:18 ` [PATCH v3 0/4] isert: the commands the target core allocates itself Yehyeong Lee

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.