summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-18 20:26:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-29 18:19:20 +0300
commite045d672ba06e1d35bacb56374d350de0ac99066 (patch)
treea7c1929884d77379964e14224091cfe65744a924 /net/ipv4
parent36f1d9c607f9457e2d8ff26eb96eb40db74b92fd (diff)
downloadlinux-e045d672ba06e1d35bacb56374d350de0ac99066.tar.xz
ipv4: Fix a data-race around sysctl_fib_multipath_use_neigh.
[ Upstream commit 87507bcb4f5de16bb419e9509d874f4db6c0ad0f ] While reading sysctl_fib_multipath_use_neigh, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: a6db4494d218 ("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>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_semantics.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 70c866308abe..3824b7abecf7 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -2232,7 +2232,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) {