diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-08-23 10:46:57 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-31 17:16:44 +0200 |
commit | b340f83dafbaf821cc2ab5f078a3652c0d09f97a (patch) | |
tree | 851912b17766944a6f98b58f5c2dcc6a3d0df7a7 /net/ipv6 | |
parent | 181bae6dff66401a2fee4345242ed8a760493a62 (diff) | |
download | linux-stable-b340f83dafbaf821cc2ab5f078a3652c0d09f97a.tar.gz linux-stable-b340f83dafbaf821cc2ab5f078a3652c0d09f97a.tar.bz2 linux-stable-b340f83dafbaf821cc2ab5f078a3652c0d09f97a.zip |
net: Fix data-races around sysctl_devconf_inherit_init_net.
[ Upstream commit a5612ca10d1aa05624ebe72633e0c8c792970833 ]
While reading sysctl_devconf_inherit_init_net, it can be changed
concurrently. Thus, we need to add READ_ONCE() to its readers.
Fixes: 856c395cfa63 ("net: introduce a knob to control whether to inherit devconf config")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6dcf034835ec..8800987fdb40 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -7128,9 +7128,8 @@ static int __net_init addrconf_init_net(struct net *net) if (!dflt) goto err_alloc_dflt; - if (IS_ENABLED(CONFIG_SYSCTL) && - !net_eq(net, &init_net)) { - switch (sysctl_devconf_inherit_init_net) { + if (!net_eq(net, &init_net)) { + switch (net_inherit_devconf()) { case 1: /* copy from init_net */ memcpy(all, init_net.ipv6.devconf_all, sizeof(ipv6_devconf)); |