Re: [PATCH v2] RDMA/srpt: Limit read data transfers to the command length
From: liuyong
Date: Wed Nov 11 2026 - 01:31:04 EST
Hi Bart,
> For the second case,
> srpt_get_desc_tbl() should reject SRP_CMD requests for which the sum
> of the direct descriptor lengths does not match the total length in
> the indirect buffer descriptor instead of building RDMA contexts for
> an inconsistent descriptor table.
Agreed. In v3, srpt_get_desc_tbl() sums the direct descriptor lengths in
u64 and rejects a total that differs from idb->len before allocating
RDMA contexts. The existing descriptor-count check is preserved.
I also initialize the command before returning BUSY for a parsing error,
so the response and completion paths have a valid command reference.
> - In srpt_queue_response(), zero the part of the data buffer beyond
> cmd->data_length, e.g. with sg_zero_buffer(), if the data buffer is
> larger than cmd->data_length.
I have replaced the WR/SGE modification loop with tail zeroing using
sg_zero_buffer(). v3 saves the original buffer length and clears the
unused tail before posting the existing RDMA transfers. Each separately
mapped SG list is synchronized for device access after zeroing. The work
requests and SGEs returned by the RDMA R/W API are left unchanged.
Thanks for the review and suggestions.
Regards,
liuyong
360 Vulnerability Research Institute