Re: [PATCH] net/rds: fix incoming message refcount leak and header bounds check in rds_recv.c

From: Allison Henderson

Date: Tue Sep 22 2026 - 02:46:37 EST


On Sat, 2026-09-19 at 22:34 +0000, Hui Peng wrote:
> In net/rds/recv.c, ensure incoming RDS message references (rds_inc_put)
> and socket receive queue bounds are properly balanced when handling
> error or truncated incoming frames.
>
Hi Hui

Thanks for the patch but this description doesn't seem to quite describe the code.
I don't see any new puts, or a leaked reference. I'm presuming there must have
been a mistake of sorts?

Allison

> Fixes: bdbe6fbc6a2f ("RDS: recv.c")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@xxxxxxxxx>
> ---
> diff --git a/net/rds/recv.c b/net/rds/recv.c
> index 6204e577a90a..0743706af8ca 100644
> --- a/net/rds/recv.c
> +++ b/net/rds/recv.c
> @@ -637,8 +637,10 @@ static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg,
> for (i = 0; i < rs->rs_rx_traces; i++) {
> j = rs->rs_rx_trace[i];
> t.rx_trace_pos[i] = j;
> - t.rx_trace[i] = inc->i_rx_lat_trace[j + 1] -
> - inc->i_rx_lat_trace[j];
> + if (inc->i_rx_lat_trace[j + 1] &&
> + inc->i_rx_lat_trace[j])
> + t.rx_trace[i] = inc->i_rx_lat_trace[j + 1] -
> + inc->i_rx_lat_trace[j];
> }
>
> ret = put_cmsg(msg, SOL_RDS, RDS_CMSG_RXPATH_LATENCY,