Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH v2 0/4] isert: the commands the target core allocates itself
@ 2026-11-18 11:39 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
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Yehyeong Lee @ 2026-11-18 11:39 UTC (permalink / raw)
  To: sagi, jgg, leon, mkp; +Cc: linux-rdma, target-devel, linux-scsi, linux-kernel

v1 was two isert patches with no cover letter:
https://lore.kernel.org/all/20261116101108.1650132-1-yhlee@isslab.korea.ac.kr/

Answering the review of v1 1/2 needs two patches in the target core, so v2
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 into a double free.  No intermediate commit has a double free
or a use-after-free; the NULL dereference is in the base tree, and 3/4
removes it.

1/4 is not about iSER.  iscsit_find_cmd_from_ttt() matches a command by
targ_xfer_tag alone, 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 two such NOP-Outs free it twice.  That is reachable on plain
iscsi_tcp one PDU after login.  It also gives the lookup's other caller,
iscsit_handle_data_ack(), the kind of command it actually wants.

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 on a LIO target with KASAN, one fresh boot per cell, arms
alternating; 2 boots per intermediate stage and 5 for the finished series,
on an iSER portal over soft-RoCE:

                                 base    1/4     1-2/4   1-3/4   1-4/4
  Reject + NOP-Out with a
   reserved ITT and TTT 0        Oops    Oops    Oops    clean   clean
  the same two PDUs paced        Oops    Oops    Oops    clean   clean
  nopin_timeout 0 then 3 on a
   logged-in iSER session        Oops    Oops    clean   clean   clean
  200 Data-Outs with a
   nonexistent ITT               128     128     128     128     200
  one Data-Out over Target-
   RecvDataSegmentLength          -       -       -       -      clean
  login, WRITE, READ verify,
   unsolicited Data-Out, logout   -       -       -       -      10/10

Every cell of the finished series is KASAN-clean: 0 reports in 30 cells.
On plain iscsi_tcp, 20 Data-Out/NOP-Out(TTT 0) pairs in one write give 19
or 20 KASAN reports per cell on base, 5 cells out of 5, and 0 with 1/4.

Regression on iscsi_tcp, base against the finished series: the nopin timer
still fires and its answer is still matched, 5 cells each, and login, READ,
WRITE, readback, logout and a CHAP login all pass with no splat.

Still open: iscsit_handle_data_ack() is the one caller whose wanted kind I
could not exercise, so that hunk of 1/4 rests on the code alone.

Yehyeong Lee (4):
  scsi: target: iscsi: match a NOP-In by opcode as well as by tag
  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       |  3 +-
 drivers/target/iscsi/iscsi_target_erl1.c  |  2 +-
 drivers/target/iscsi/iscsi_target_login.c |  5 ---
 drivers/target/iscsi/iscsi_target_util.c  | 16 +++++++--
 drivers/target/iscsi/iscsi_target_util.h  |  4 ++-
 6 files changed, 51 insertions(+), 20 deletions(-)

-- 
2.43.0


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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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 12:01   ` sashiko-bot
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:54   ` sashiko-bot
2026-11-18 11:39 ` [PATCH v2 4/4] IB/isert: do not leak the receive descriptor of a dropped Data-Out Yehyeong Lee
2026-11-18 11:46   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox