diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-12 03:15:33 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-21 22:20:10 +0300 |
commit | a51040d4b120f3520df64fb0b9c63b31d69bea9b (patch) | |
tree | 92bb629fb06f462bcf654e40ebf049fe83e5f7ea /net/ipv6/route.c | |
parent | 2c56958de89b9a2efdb19310e3f11a6b97254d39 (diff) | |
download | linux-a51040d4b120f3520df64fb0b9c63b31d69bea9b.tar.xz |
nexthop: Fix data-races around nexthop_compat_mode.
[ Upstream commit bdf00bf24bef9be1ca641a6390fd5487873e0d2e ]
While reading nexthop_compat_mode, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its readers.
Fixes: 4f80116d3df3 ("net: ipv4: add sysctl for nexthop api compatibility mode")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index e67505c6d856..cdf215442d37 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5641,7 +5641,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, if (nexthop_is_blackhole(rt->nh)) rtm->rtm_type = RTN_BLACKHOLE; - if (net->ipv4.sysctl_nexthop_compat_mode && + if (READ_ONCE(net->ipv4.sysctl_nexthop_compat_mode) && rt6_fill_node_nexthop(skb, rt->nh, &nh_flags) < 0) goto nla_put_failure; |