All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hang Nan" <2122295973@qq.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH net 1/2] net: mptcp: take token lookup references with acquire ordering
Date: Fri, 13 Nov 2026 12:46:09 +0000	[thread overview]
Message-ID: <sashiko-outbox-212783@kernel.org> (raw)
In-Reply-To: <tencent_28A2BD1631FE531992E91753BA6419FFC506@qq.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net: mptcp: Fixes trailer cites commit predating token.c
  lockless lookups
--

commit 5447c2a648739689de81e739dc020bec5eb37b64
Author: Hang Nan <2122295973@qq.com>

> net: mptcp: take token lookup references with acquire ordering
>
> mptcp_token_get_sock() validates the token and the network namespace,
> takes a reference on the socket and then validates them again.  The
> second validation only rejects a socket that is being torn down if it is
> ordered after the reference acquisition: mptcp_token_destroy() unlinks
> the socket and does WRITE_ONCE(msk->token, 0), so a reader that observes
> the token before the acquisition can return a socket whose token has
> already been cleared.
>
> refcount_inc_not_zero() does not provide acquire ordering since the
> refcount_t consolidation in fb041bb7c0a9, which removed the ordering
> that the previous atomic_add_unless() based implementation gave.  On
> weakly ordered CPUs the loads of msk->token and sock_net(sk) can
> therefore be reordered before the refcount increment, defeating the
> re-validation.
>
> The same pattern was fixed for the IPv4 and IPv6 established lookups,
> inet_twsk_purge() and bpf_sk_assign() in 5b5d8f351dd9.  The iterator
> below has the same shape and is converted as well.
>
> No behaviour change on strongly ordered architectures; this only
> restores the ordering the second validation relies on.
>
> Fixes: fb041bb7c0a9 ("locking/refcount: Consolidate implementations of refcount_t")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hang Nan <2122295973@qq.com>

[Severity: Low]
fb041bb7c0a9 ("locking/refcount: Consolidate implementations of
refcount_t") predates net/mptcp/token.c and its lockless RCU token
lookups.  Should the Fixes tags point to the commits that introduced the
lockless refcount_inc_not_zero() lookups in mptcp_token_get_sock() and
mptcp_token_iter_next() instead?

  Fixes: 2c5ebd001d4f ("mptcp: refactor token container")
  Fixes: 96d890daad05 ("mptcp: add msk interations helper")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_28A2BD1631FE531992E91753BA6419FFC506@qq.com?part=1

  parent reply	other threads:[~2026-11-13 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261112124547.193812-1-2122295973@qq.com>
2026-11-12 12:45 ` [PATCH net 1/2] net: mptcp: take token lookup references with acquire ordering Hang Nan
2026-11-12 12:50   ` netdev-bot+sinfo
2026-11-13 12:46   ` sashiko-bot [this message]
2026-11-13 13:05   ` netdev-bot+sashiko
2026-11-12 12:45 ` [PATCH net 2/2] net: core: take the reuseport migration reference " Hang Nan
2026-11-13 12:46   ` sashiko-bot
2026-11-13 13:05   ` netdev-bot+sashiko
     [not found] ` <20261112124547.193812-2-2122295973@qq.com>
2026-11-12 12:52   ` [PATCH net 1/2] net: mptcp: take token lookup references " Hang Nan

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=sashiko-outbox-212783@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=2122295973@qq.com \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.