While reading sysctl_fb_tunnels_only_for_init_net, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -640,9 +640,14 @@ extern int sysctl_devconf_inherit_init_net; · 639 unmodified lines | ||
| 640 | 640 | */ |
| 641 | 641 | static inline bool net_has_fallback_tunnels(const struct net *net) |
| 642 | 642 | { |
| 643 | − return !IS_ENABLED(CONFIG_SYSCTL) || | |
| 644 | − !sysctl_fb_tunnels_only_for_init_net || | |
| 645 | − (net == &init_net && sysctl_fb_tunnels_only_for_init_net == 1); | |
| 643 | +#if IS_ENABLED(CONFIG_SYSCTL) | |
| 644 | + int fb_tunnels_only_for_init_net = READ_ONCE(sysctl_fb_tunnels_only_for_init_net); | |
| 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 | 653 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) |