Re: [PATCH net v9 2/6] net/smc: bound the receive length to the RMB
From: Bryam Vargas
Date: Sat Nov 28 2026 - 09:49:13 EST
On Mon, 16 Nov 2026 13:00:35 +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> - [High] The patch relies on spliced bytes being counted exactly once: in
> bytes_to_rcv until they are handed to the pipe, then in splice_pending...
Both cases hold by inspection and neither is new: the review of v8 [1]
described both. They are the error exit of the chunk loop in
smc_rx_recvmsg() and the debit after the loop; 2/6 changes only the
comment on that debit. The failed second chunk dates from 9014db202cb7;
the short count needs a vmalloc'ed RMB, so b8d199451c99.
The bound doesn't rely on the single count: min(bytes_to_rcv, rmb_len -
splice_pending) keeps the read that follows either case inside the RMB,
double count included (by inspection). The commit message says the
splice_pending change is only for a reader that runs between the cursor
update and the drop in smc_rx_pipe_buf_release(), and the changelog in
the cover says the failed second chunk is a different bug, not fixed
here.
What goes wrong after that is the same as on unpatched. After case 1
the read returns stale bytes from past the producer cursor and cons
ends past it; I haven't worked out what the peer's writes do then.
After case 2 splice() has reported bytes the pipe never got, and the rx
window the peer sees stays short by that many.
Hidayath Khan's "net/smc: do not credit bytes that splice() did not
take" [2] covers this accounting: the patch handles the short count,
your case 2, and its review raised the failed second chunk, case 1,
which Hidayath agreed to fix in v2. The same review raised the
splice_pending drop that 2/6 moves; his reply announced a separate
patch for it.
> Pre-existing issues:
> - [High] This problem wasn't introduced by this patch, but spliced pipe
> buffers keep pointing into an RMB that has already been handed back...
By inspection, yes: nothing holds the RMB slot while a pipe buffer
points into it, and smc_conn_free() doesn't look at splice_pending.
The conn->freed test isn't from this series, and 2/6 only moves the
splice_pending drop that follows it.
[1] https://lore.kernel.org/all/179364387064.3131.5492897013975868107@xxxxxxxxxx/
[2] https://lore.kernel.org/all/20260820085543.967490-1-hidayath@xxxxxxxxxxxxx/
Thanks,
Bryam