Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH v7 0/6] IB/isert: fix the device removal use-after-free
@ 2026-11-04  1:22 Yehyeong Lee
  2026-11-04  1:22 ` [PATCH v7 1/6] IB/isert: do not publish connections being released on a second list Yehyeong Lee
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Yehyeong Lee @ 2026-11-04  1:22 UTC (permalink / raw)
  To: Sagi Grimberg, Max Gurtovoy, Jason Gunthorpe, Leon Romanovsky
  Cc: Martin K . Petersen, Mike Christie, linux-rdma, target-devel,
	linux-kernel, Yehyeong Lee

The RDMA_CM_EVENT_DEVICE_REMOVAL callback in ib_isert waits for the
connection it was handed to reach ISER_CONN_DOWN and then frees it, a
use-after-free against isert_connect_release(), and the wait deadlocks
against the handler_mutex rdma_destroy_id() needs.  3/6 moves the teardown
into an ib_client callback, as nvmet-rdma did in f1d4ef7d8883, and gives
every connection one owner.  1/6 and 2/6 are older problems; 4/6, 5/6 and
6/6 close three holes the walk makes visible.

v6 -> v7

v6: https://lore.kernel.org/r/20261103223802.1697607-1-yhlee@isslab.korea.ac.kr

v5: https://lore.kernel.org/r/20261103125955.1530355-1-yhlee@isslab.korea.ac.kr

v4: https://lore.kernel.org/r/20261103032924.1073138-1-yhlee@isslab.korea.ac.kr

Sashiko v6 5/6 Medium: set removing in the same critical section that
clears the client data.  isert_remove_one() cleared the ib_client data and
took its device reference under device_list_mutex, and set the removing
flag only in a later section.  Between the two an isert_device_get() for
another device with the same node_guid still saw the departing device as
usable and raised its reference count.  5/6 now takes isert_conn_mutex
first and does the clear, the lookup, the reference, the completion and
the flag in one device_list_mutex section.  No path in the series holds
device_list_mutex while taking isert_conn_mutex.  Nothing else changed:
1/6 to 4/6 and 6/6 are the same commits as in v6.

Measured over soft-RoCE with KASAN.  Parking isert_remove_one() after its
lookup and connecting on a second device with the same node_guid gave the
departing device two more references on v6 in both runs and none on v7.
Everything else is unchanged from v6: 140 runs with no KASAN, no Oops, no
lockdep splat and no refcount warning on either side, the late-device
window building one device and no core warning in six of eighteen runs,
twenty link removals and re-adds leaving device_list empty, and the login
park finishing in eight seconds.  I still could not measure the namespace
move, for the reason given in v6.

Yehyeong Lee (6):
  IB/isert: do not publish connections being released on a second list
  IB/isert: drain the QP without holding isert_conn->mutex
  IB/isert: tear connections down from an ib_client on device removal
  IB/isert: drop the promotion reference when a connection errors out
  IB/isert: do not build a new isert_device for a device being removed
  IB/isert: only reinstate a connection that reached full feature phase

 drivers/infiniband/ulp/isert/ib_isert.c | 399 +++++++++++++++++-------
 drivers/infiniband/ulp/isert/ib_isert.h |   9 +-
 2 files changed, 297 insertions(+), 111 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.43.0


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

end of thread, other threads:[~2026-11-04  4:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  1:22 [PATCH v7 0/6] IB/isert: fix the device removal use-after-free Yehyeong Lee
2026-11-04  1:22 ` [PATCH v7 1/6] IB/isert: do not publish connections being released on a second list Yehyeong Lee
2026-11-04  1:45   ` sashiko-bot
2026-11-04  1:22 ` [PATCH v7 2/6] IB/isert: drain the QP without holding isert_conn->mutex Yehyeong Lee
2026-11-04  1:47   ` sashiko-bot
2026-11-04  1:22 ` [PATCH v7 3/6] IB/isert: tear connections down from an ib_client on device removal Yehyeong Lee
2026-11-04  1:58   ` sashiko-bot
2026-11-04  1:22 ` [PATCH v7 4/6] IB/isert: drop the promotion reference when a connection errors out Yehyeong Lee
2026-11-04  1:34   ` sashiko-bot
2026-11-04  1:22 ` [PATCH v7 5/6] IB/isert: do not build a new isert_device for a device being removed Yehyeong Lee
2026-11-04  1:43   ` sashiko-bot
2026-11-04  1:22 ` [PATCH v7 6/6] IB/isert: only reinstate a connection that reached full feature phase Yehyeong Lee
2026-11-04  1:37   ` sashiko-bot
2026-11-04  4:05 ` [PATCH v7 0/6] IB/isert: fix the device removal use-after-free Yehyeong Lee

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