While reading sysctl_fb_tunnels_only_for_init_net, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
Unified · Split
| @@ -640,9 +640,14 @@ extern int sysctl_devconf_inherit_init_net; · 639 unmodified lines | |||
| 640 | */ | 640 | */ |
| 641 | static inline bool net_has_fallback_tunnels(const struct net *net) | 641 | static inline bool net_has_fallback_tunnels(const struct net *net) |
| 642 | { | 642 | { |
| 643 | return !IS_ENABLED(CONFIG_SYSCTL) || | 643 | #if IS_ENABLED(CONFIG_SYSCTL) |
| 644 | !sysctl_fb_tunnels_only_for_init_net || | 644 | int fb_tunnels_only_for_init_net = READ_ONCE(sysctl_fb_tunnels_only_for_init_net); |
| 645 | (net == &init_net && sysctl_fb_tunnels_only_for_init_net == 1); | 645 | |
| 646 | return !fb_tunnels_only_for_init_net || | ||
| 647 | (net_eq(net, &init_net) && fb_tunnels_only_for_init_net == 1); | ||
| 648 | #else | ||
| 649 | return true; | ||
| 650 | #endif | ||
| 646 | } | 651 | } |
| 647 | 652 | ||
| 648 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) | 653 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) |