Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH v4 0/2] RDMA/srpt: fix the indirect descriptor table bound and the context counters
@ 2026-10-24 16:28 Yehyeong Lee
  2026-10-24 16:28 ` [PATCH v4 1/2] RDMA/srpt: bound the indirect descriptor table to the IU Yehyeong Lee
  2026-10-24 16:28 ` [PATCH v4 2/2] RDMA/srpt: widen the indirect RDMA context counters Yehyeong Lee
  0 siblings, 2 replies; 9+ messages in thread
From: Yehyeong Lee @ 2026-10-24 16:28 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Leon Romanovsky, Jason Gunthorpe, linux-rdma, target-devel,
	linux-kernel, stable, yhlee

Both changes are needed, and they fix different things.

A 510 entry table fits in the default 8276 byte IU when the additional CDB
is empty, so the bound accepts it and the counters then have to hold it.
With only the bound, a conforming command carrying 256 or more descriptors
still wraps n_rw_ctx and leaks every context it allocated. With only the
wider counters, a command that sets ADDITIONAL CDB LENGTH to its maximum
still walks a descriptor table that runs past the receive buffer.

The two defects also come from different commits, which is why they are
split here.

Changes since v3, both from the review of 1/2.

desc_off is a uintptr_t subtraction now, as Bart asked.

The room check is gone. It divided the bytes left after the header by the
descriptor size, and the division truncates toward zero, so a byte_len one
to fifteen bytes short of the header gave room zero rather than negative.
A table_desc.len below one descriptor gives nbufs zero at the same time, so
nbufs > room was false and a truncated request was accepted. That is
Sashiko's [Medium], and the v3 commit message claimed the opposite. v4
compares the span the table occupies against byte_len directly, which needs
no division and no sign, and the wrong paragraph is gone.

2/2 is unchanged. Bart asked why int rather than an unsigned type. The
values are counts and never negative, so unsigned fits, but
rdma_rw_ctx_init() returns int and the WARN_ON(ioctx->n_rdma <= 0) in
srpt_rdma_read_done() is a signed test, so int leaves the surrounding code
alone. I am happy to make both unsigned int and turn that test into == 0
instead.

Link: https://lore.kernel.org/linux-rdma/20261022143901.2991062-1-yhlee@isslab.korea.ac.kr

Yehyeong Lee (2):
  RDMA/srpt: bound the indirect descriptor table to the IU
  RDMA/srpt: widen the indirect RDMA context counters

 drivers/infiniband/ulp/srpt/ib_srpt.c | 11 ++++++++++-
 drivers/infiniband/ulp/srpt/ib_srpt.h |  4 ++--
 2 files changed, 12 insertions(+), 3 deletions(-)


base-commit: 5b0764a53235d3c77e1ed674e836e1b3fe1a4b1f
-- 
2.43.0


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

end of thread, other threads:[~2026-10-25  1:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-24 16:28 [PATCH v4 0/2] RDMA/srpt: fix the indirect descriptor table bound and the context counters Yehyeong Lee
2026-10-24 16:28 ` [PATCH v4 1/2] RDMA/srpt: bound the indirect descriptor table to the IU Yehyeong Lee
2026-10-24 17:06   ` sashiko-bot
2026-10-24 18:01     ` Bart Van Assche
2026-10-25  1:47       ` Yehyeong Lee
2026-10-24 16:28 ` [PATCH v4 2/2] RDMA/srpt: widen the indirect RDMA context counters Yehyeong Lee
2026-10-24 16:56   ` sashiko-bot
2026-10-24 18:02   ` Bart Van Assche
2026-10-25  1:47     ` Yehyeong Lee

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