diff options
author | 2022-08-23 10:46:57 -0700 | |
---|---|---|
committer | 2022-08-24 13:46:58 +0100 | |
commit | a5612ca10d1aa05624ebe72633e0c8c792970833 (patch) | |
tree | c684dfb70112852bc34790fed94b3cb894f52058 /include/linux/netdevice.h | |
parent | net: Fix data-races around sysctl_fb_tunnels_only_for_init_net. (diff) | |
download | linux-dev-a5612ca10d1aa05624ebe72633e0c8c792970833.tar.xz linux-dev-a5612ca10d1aa05624ebe72633e0c8c792970833.zip |
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 '')
-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) |