From: Mahanta Jambigi <mjambigi@linux.ibm.com>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, alibuda@linux.alibaba.com,
dust.li@linux.alibaba.com, sidraya@linux.ibm.com
Cc: pasic@linux.ibm.com, horms@kernel.org, tonylu@linux.alibaba.com,
guwen@linux.alibaba.com, netdev@vger.kernel.org,
linux-s390@vger.kernel.org
Subject: Re: [PATCH net v3] net/smc: fix clcsock and lgr/lnk races in smc_diag dump path
Date: Mon, 17 Aug 2026 18:13:50 +0530 [thread overview]
Message-ID: <4954a75a-7dfe-437e-9a2d-17dcf81b4416@linux.ibm.com> (raw)
In-Reply-To: <20260807081606.3200128-1-mjambigi@linux.ibm.com>
On 07/08/26 1:46 pm, Mahanta Jambigi wrote:
> Two races in the SMC diag dump path:
>
> Race 1: smc_diag_msg_common_fill() reads smc->clcsock fields after a
> NULL check, but smc_clcsock_release() can set clcsock = NULL under
> clcsock_release_lock between the check and the reads. Hold the same
> mutex in the read path to make the check and reads atomic.
>
> Race 2: __smc_diag_dump() dereferences conn->lgr and conn->lnk with no
> protection against concurrent teardown. smc_close_active_abort() calls
> smc_conn_free() — which drops lgr and link refcounts — without first
> unhashing the socket, leaving stale pointers visible to the dump. The
> teardown path holds lock_sock(sk) across smc_conn_free(); take the same
> lock in __smc_diag_dump() to serialise fully.
>
> Both fixes require sleeping locks, which are illegal under the
> read_lock(&smc_hash->lock) held by smc_diag_dump_proto(). Pin each
> socket with refcount_inc_not_zero() before dropping the hash lock, call
> __smc_diag_dump() locklessly, then release the pin. Restart sk_for_each()
> from head after each unlock rather than resuming mid-walk:
> smc_unhash_sk() nulls sk->sk_node.next via sk_del_node_init(), so
> resuming an interrupted walk silently truncates the dump.
>
> Fixes: f16a7dd5cf27 ("smc: netlink interface for SMC sockets")
> Fixes: 9dbe086c69b8 ("net/smc: fix invalid link access in dumping SMC-R connections")
> Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
> Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Hi D. Wythe and team,
I have addressed the review comments from syzbot and Sashiko for this
patch. Could you please review this when convenient?
Also, the following patch is related to the current patch and may be
reviewed together:
https://lore.kernel.org/netdev/20260813074315.554926-1-mjambigi@linux.ibm.com/
next prev parent reply other threads:[~2026-08-17 12:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 8:16 [PATCH net v3] net/smc: fix clcsock and lgr/lnk races in smc_diag dump path Mahanta Jambigi
2026-08-07 9:12 ` Mahanta Jambigi
2026-08-07 15:02 ` [syzbot ci] " syzbot ci
2026-08-13 7:25 ` Mahanta Jambigi
2026-08-08 8:16 ` [PATCH net v3] " sashiko-bot
2026-08-13 7:33 ` Mahanta Jambigi
2026-08-17 12:43 ` Mahanta Jambigi [this message]
2026-08-24 7:15 ` Mahanta Jambigi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4954a75a-7dfe-437e-9a2d-17dcf81b4416@linux.ibm.com \
--to=mjambigi@linux.ibm.com \
--cc=alibuda@linux.alibaba.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dust.li@linux.alibaba.com \
--cc=edumazet@google.com \
--cc=guwen@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox