From: Kuniyuki Iwashima Date: Mon, 18 Jul 2022 17:26:39 +0000 (-0700) Subject: ipv4: Fix a data-race around sysctl_fib_multipath_use_neigh. X-Git-Tag: baikal/mips/sdk6.1~5282^2~3^2~14 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=579b451998bfa384905861b10ca4bdb53e682ab6;p=kernel.git 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: f596ce6f4c9e ("net: ipv4: Consider failed nexthops in multipath routes") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller --- diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index d9fdcbae16ee3..db7b2503f0682 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -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) {