diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-08-23 20:46:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-08-24 15:46:58 +0300 |
commit | a5612ca10d1aa05624ebe72633e0c8c792970833 (patch) | |
tree | c684dfb70112852bc34790fed94b3cb894f52058 /net/ipv6/addrconf.c | |
parent | af67508ea6cbf0e4ea27f8120056fa2efce127dd (diff) | |
download | linux-a5612ca10d1aa05624ebe72633e0c8c792970833.tar.xz |
net: Fix data-races around sysctl_devconf_inherit_init_net.
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>
Diffstat (limited to 'net/ipv6/addrconf.c')
-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 b624e3d8c5f0..e15f64f22fa8 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -7162,9 +7162,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)); |