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: 4f80116d3d
("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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
2c56958de8
commit
a51040d4b1
@@ -1831,7 +1831,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
|
||||
goto nla_put_failure;
|
||||
if (nexthop_is_blackhole(fi->nh))
|
||||
rtm->rtm_type = RTN_BLACKHOLE;
|
||||
if (!fi->fib_net->ipv4.sysctl_nexthop_compat_mode)
|
||||
if (!READ_ONCE(fi->fib_net->ipv4.sysctl_nexthop_compat_mode))
|
||||
goto offload;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user