Commit 87507bcb authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by David S. Miller

ipv4: Fix a data-race around sysctl_fib_multipath_use_neigh.

While reading sysctl_fib_multipath_use_neigh, it can be changed
concurrently.  Thus, we need to add READ_ONCE() to its reader.

Fixes: a6db4494 ("net: ipv4: Consider failed nexthops in multipath routes")
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ef562175
...@@ -2216,7 +2216,7 @@ void fib_select_multipath(struct fib_result *res, int hash) ...@@ -2216,7 +2216,7 @@ void fib_select_multipath(struct fib_result *res, int hash)
} }
change_nexthops(fi) { change_nexthops(fi) {
if (net->ipv4.sysctl_fib_multipath_use_neigh) { if (READ_ONCE(net->ipv4.sysctl_fib_multipath_use_neigh)) {
if (!fib_good_nh(nexthop_nh)) if (!fib_good_nh(nexthop_nh))
continue; continue;
if (!first) { if (!first) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment