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 /include/linux/netdevice.h | |
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 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6d3a33fd0cdb..05d6f3facd5a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -650,6 +650,15 @@ static inline bool net_has_fallback_tunnels(const struct net *net) #endif } +static inline int net_inherit_devconf(void) +{ +#if IS_ENABLED(CONFIG_SYSCTL) + return READ_ONCE(sysctl_devconf_inherit_init_net); +#else + return 0; +#endif +} + static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) { #if defined(CONFIG_XPS) && defined(CONFIG_NUMA) |