Re: [PATCH net v3 2/2] net/smc: do not reuse the DMB of a nocopy device
From: Bryam Vargas
Date: Thu Dec 03 2026 - 01:06:59 EST
On 30.11.26 11:24, Alexandra Winter wrote:
> I think the same concept applies when the smcd device does not support
> nocopy (ISM devices). When the dmb is in link group's unused pool, while
> it is still registered with the dibs device, the peer can write into the
> dmb.
Agreed, by reading: the pooled DMB keeps its token, and a peer that
still has the token can write to the DMB. I only measured loopback; I
have no ISM.
> Isn't there some mechanism in SMC that makes sure old date can never be
> read in a re-used dmb?
smc_buf_unuse() zeroes the DMB when the connection ends. That is all I
found, and it does not cover a write that comes later. On loopback the
old peer's CDC lands in the DMB after the next connection has taken
it, and that connection reads EOF while its own client is open.
> I don't understand all the observed issues in v3 0/2, but maybe some of
> them can be solved in __smc_buf_create() instead of smc_buf_unuse() ?
Maybe, with two limits. On loopback the old peer is attached to the
DMB and writes its data straight into that memory, so a DMB it still
holds cannot go to another connection, in either function. And a late
attach finds the DMB by its token, so a pooled DMB would need a new
token before it is taken again. I have not tried that.
> Would it make sense to postpone 2/2 and proceed with 1/2?
Yes. v4 is 1/2 alone:
https://lore.kernel.org/all/20261203-b4-disp-b330a4df-v4-1-bafca73822d0@xxxxxxxxx/
2/2 is not ready as it is anyway: Sashiko flagged a stale descriptor
in it on v3.
Thanks,
Bryam
pw-bot: cr