[PATCH v4 0/2] RDMA/srpt: fix the indirect descriptor table bound and the context counters
From: Yehyeong Lee
Date: Sat Oct 24 2026 - 12:32:07 EST
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@xxxxxxxxxxxxxxxxxx
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