Re: [PATCH net v2] net/smc: prevent device removal during connection setup

Simon Horman <[email protected]>
Newsgroups org.kernel.vger.linux-s390,org.kernel.vger.linux-kernel,org.kernel.vger.linux-rdma,org.kernel.vger.netdev,org.kernel.vger.stable
Message-ID <[email protected]>
On Sun, Aug 23, 2026 at 11:37:17AM +0200, Markus Elfring wrote:
> …
> > This change is limited to the reported SMCR lifetime race. SMC-D device
> > selection has a similar pre-existing borrowed-pointer lifetime issue and
> > requires a separate fix.
> 
> May lock guards be applied?
> https://elixir.bootlin.com/linux/v7.2/source/include/linux/mutex.h#L253

This approach seems fine to me.

Quoting the documentation:

  Use of guard() is discouraged within any function longer than 20 lines,
  scoped_guard() is considered more readable. Using normal lock/unlock is
  still (weakly) preferred.

  Link: https://docs.kernel.org/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs

Reviewed-by: Simon Horman <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.