[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220818161704.32634-1-kuniyu@amazon.com>
Date: Thu, 18 Aug 2022 09:17:04 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kuniyu@...zon.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<kuni1840@...il.com>, <netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH v2 net 13/17] net: Fix data-races around sysctl_fb_tunnels_only_for_init_net.
From: Kuniyuki Iwashima <kuniyu@...zon.com>
Date: Wed, 17 Aug 2022 20:52:23 -0700
> While reading sysctl_fb_tunnels_only_for_init_net, it can be changed
> concurrently. Thus, we need to add READ_ONCE() to its readers.
>
> Fixes: 79134e6ce2c9 ("net: do not create fallback tunnels for non-default namespaces")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> include/linux/netdevice.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 1a3cb93c3dcc..89a9545d90db 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -640,9 +640,11 @@ extern int sysctl_devconf_inherit_init_net;
> */
> static inline bool net_has_fallback_tunnels(const struct net *net)
> {
> + int fb_tunnels_only_for_init_net = READ_ONCE(sysctl_fb_tunnels_only_for_init_net);
> +
This should be in the #if IS_ENABLED(CONFIG_SYSCTL) block...my bad.
I'll fix this in v3.
> return !IS_ENABLED(CONFIG_SYSCTL) ||
> - !sysctl_fb_tunnels_only_for_init_net ||
> - (net == &init_net && sysctl_fb_tunnels_only_for_init_net == 1);
> + !fb_tunnels_only_for_init_net ||
> + (net == &init_net && fb_tunnels_only_for_init_net == 1);
> }
>
> static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
> --
> 2.30.2
Powered by blists - more mailing lists