MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
	MPTCP Linux <mptcp@lists.linux.dev>
Subject: Re: [PATCH mptcp-next 4/4] mptcp: use READ_ONCE() over sysctls
Date: Thu, 02 Jul 2026 13:37:59 +0800	[thread overview]
Message-ID: <90819ea85ce4e27d901f1d67114b01de8ea485bf.camel@kernel.org> (raw)
In-Reply-To: <20260601-mptcp-add-addr6-port-ts-fixes-v2-v1-4-d7c842e80446@kernel.org>

Hi Matt,

Thanks for this patch.

On Mon, 2026-06-01 at 18:27 +1000, Matthieu Baerts (NGI0) wrote:
> To avoid KCSAN issues.
> 
> This patch is in theory for -net, and will need to be split in
> multiple
> patches, with different Fixes tags. But I prefer to wait for Eric's
> patches, as I noticed he already started to modify mptcp_is_enabled:
> 
>  
> https://lore.kernel.org/CANn89iLdwhhwLyO6zRjWMEY3t9g60ZE8ZhOVx33ucg_uRETbmQ@mail.gmail.com
> 
> Still, keeping this patch in this series, not to forget about it.
> 
> Reported-by: Eric Dumazet <edumazet@google.com>
> Closes:
> https://lore.kernel.org/CANn89iL=os-60kDKqMDdyiXuPF5CG=eejS0vmthwpDGXz_Bp8A@mail.gmail.com
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
>  net/mptcp/ctrl.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
> index 63c5747f0f63..1dee42601700 100644
> --- a/net/mptcp/ctrl.c
> +++ b/net/mptcp/ctrl.c
> @@ -50,39 +50,39 @@ static struct mptcp_pernet
> *mptcp_get_pernet(const struct net *net)
>  
>  int mptcp_is_enabled(const struct net *net)
>  {
> -	return mptcp_get_pernet(net)->mptcp_enabled;
> +	return READ_ONCE(mptcp_get_pernet(net)->mptcp_enabled);
>  }
>  
>  unsigned int mptcp_get_add_addr_timeout(const struct net *net)
>  {
> -	return mptcp_get_pernet(net)->add_addr_timeout;
> +	return READ_ONCE(mptcp_get_pernet(net)->add_addr_timeout);
>  }
>  
>  int mptcp_is_checksum_enabled(const struct net *net)
>  {
> -	return mptcp_get_pernet(net)->checksum_enabled;
> +	return READ_ONCE(mptcp_get_pernet(net)->checksum_enabled);
>  }
>  
>  int mptcp_allow_join_id0(const struct net *net)
>  {
> -	return mptcp_get_pernet(net)->allow_join_initial_addr_port;
> +	return READ_ONCE(mptcp_get_pernet(net)-
> >allow_join_initial_addr_port);
>  }
>  
>  unsigned int mptcp_stale_loss_cnt(const struct net *net)
>  {
> -	return mptcp_get_pernet(net)->stale_loss_cnt;
> +	return READ_ONCE(mptcp_get_pernet(net)->stale_loss_cnt);
>  }
>  
>  unsigned int mptcp_close_timeout(const struct sock *sk)
>  {
>  	if (sock_flag(sk, SOCK_DEAD))
>  		return TCP_TIMEWAIT_LEN;
> -	return mptcp_get_pernet(sock_net(sk))->close_timeout;
> +	return READ_ONCE(mptcp_get_pernet(sock_net(sk))-
> >close_timeout);
>  }
>  
>  int mptcp_get_pm_type(const struct net *net)
>  {
> -	return mptcp_get_pernet(net)->pm_type;
> +	return READ_ONCE(mptcp_get_pernet(net)->pm_type);
>  }
>  
>  const char *mptcp_get_path_manager(const struct net *net)
> @@ -551,7 +551,7 @@ void mptcp_active_detect_blackhole(struct sock
> *ssk, bool expired)
>  
>  	net = sock_net(ssk);
>  	timeouts = inet_csk(ssk)->icsk_retransmits;
> -	to_max = mptcp_get_pernet(net)-
> >syn_retrans_before_tcp_fallback;
> +	to_max = READ_ONCE(mptcp_get_pernet(net)-
> >syn_retrans_before_tcp_fallback);
>  
>  	if (timeouts == to_max || (timeouts < to_max && expired)) {
>  		subflow->mpc_drop = 1;
> 

I hesitated for a moment about why READ_ONCE() was not added in
mptcp_get_path_manager() and mptcp_get_scheduler(), and the result is
that they are defined as arrays rather than pointers, so READ_ONCE() is
not applicable.

So this patch looks good to me.

    Reviewed-by: Geliang Tang <geliang@kernel.org>

Thanks,
-Geliang



  reply	other threads:[~2026-07-02  5:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  8:27 [PATCH mptcp-next 0/4] Fixes for "mptcp: pm: drop TCP TS with ADD_ADDRv6 + port" Matthieu Baerts (NGI0)
2026-06-01  8:27 ` [PATCH mptcp-next 1/4] Squash to: "mptcp: introduce add_addr_v6_port_drop_ts sysctl knob" Matthieu Baerts (NGI0)
2026-06-01  8:27 ` [PATCH mptcp-next 2/4] Squash to "tcp: allow mptcp to drop TS for some packets" Matthieu Baerts (NGI0)
2026-06-01  8:27 ` [PATCH mptcp-next 3/4] Squash to "mptcp: pm: drop TCP TS with ADD_ADDRv6 + port" Matthieu Baerts (NGI0)
2026-06-01  8:27 ` [PATCH mptcp-next 4/4] mptcp: use READ_ONCE() over sysctls Matthieu Baerts (NGI0)
2026-07-02  5:37   ` Geliang Tang [this message]
2026-06-01  9:04 ` [PATCH mptcp-next 0/4] Fixes for "mptcp: pm: drop TCP TS with ADD_ADDRv6 + port" MPTCP CI
2026-06-01  9:54 ` MPTCP CI
2026-06-02  6:31 ` Matthieu Baerts
2026-06-02  6:59   ` Matthieu Baerts

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=90819ea85ce4e27d901f1d67114b01de8ea485bf.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox