Thread (13 messages) flat view 13 messages, 3 authors, 14h ago

Re: [PATCH net v2 0/2] net/smc: fix diag dump lifetime races

From: Dust Li <dust.li@linux.alibaba.com>
Date: 2026-08-31 13:42:43
Also in: linux-rdma, linux-s390, stable

On 2026-08-28 08:54:37, Mahanta Jambigi wrote:
This series fixes multiple lifetime races in the SMC diag dump path.

The first patch adds the basic infrastructure needed to synchronize diag readers
against connection-owned conn->lgr/conn->lnk updates. It introduces a
per-connection spinlock and uses it in the link switch and connection free
handoff paths. conn->lgr and conn->lnk are NULLed under the lock before the
borrowed references are released, so a non-NULL conn->lgr seen under the lock
guarantees the lgr object is alive. The diag reader can rely on this invariant
without borrowing any extra reference.

The second patch fixes two races in smc_diag itself:

- serialize clcsock field access against smc_clcsock_release() with
 mutex_trylock()
- take conn->lgr_lnk_lock when reading conn->lgr and conn->lnk; use
 smc_conn_lgr_valid() inside the lock to check that the connection is
 still registered, then snapshot all required fields and call nla_put()
 after releasing the lock
Hi Mahanta,

As discussed in the other thread, I think we should defer the release of
smc->clcsock and remove clcsock_release_lock.

In that case, we should no longer need these two patches. Also,
introducing more locks in SMC is the last thing I want to do :)

Best regards,
Dust
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help