summaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-11 17:15:33 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-21 21:24:28 +0200
commit0d17723afea3ae8c9f245c9bbd2ba5945b77e812 (patch)
treecd9b6827ee62dbf0c53ea5d85e656d829461bd2b /net/ipv6
parent6b26fb2fe227317f6afdc8ffbdbe7819aecce643 (diff)
downloadlinux-stable-0d17723afea3ae8c9f245c9bbd2ba5945b77e812.tar.gz
linux-stable-0d17723afea3ae8c9f245c9bbd2ba5945b77e812.tar.bz2
linux-stable-0d17723afea3ae8c9f245c9bbd2ba5945b77e812.zip
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')
-rw-r--r--net/ipv6/route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4ca754c360a3..27274fc3619a 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5756,7 +5756,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;