Skip to content

Commit

Permalink
ipv4: Fix a data-race around sysctl_fib_multipath_use_neigh.
Browse files Browse the repository at this point in the history
[ Upstream commit 87507bc ]

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

Fixes: a6db449 ("net: ipv4: Consider failed nexthops in multipath routes")
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>
  • Loading branch information
q2ven authored and gregkh committed Jul 29, 2022
1 parent 789085d commit 14e9965
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/fib_semantics.c
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ void fib_select_multipath(struct fib_result *res, int hash)
}

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))
continue;
if (!first) {
Expand Down

0 comments on commit 14e9965

Please sign in to comment.