summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-18 10:26:40 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-29 17:25:21 +0200
commit21fb844bc1dc1461f5038d655aa1a14f39e13049 (patch)
treefc253277ddf7bcc5bf2ce23ad227eb3e4fbec7d5 /net/ipv4
parentb8d345db03b4deffb4f04219a51d3b1e94171b76 (diff)
downloadlinux-stable-21fb844bc1dc1461f5038d655aa1a14f39e13049.tar.gz
linux-stable-21fb844bc1dc1461f5038d655aa1a14f39e13049.tar.bz2
linux-stable-21fb844bc1dc1461f5038d655aa1a14f39e13049.zip
ipv4: Fix data-races around sysctl_fib_multipath_hash_policy.
[ Upstream commit 7998c12a08c97cc26660532c9f90a34bd7d8da5a ] While reading sysctl_fib_multipath_hash_policy, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: bf4e0a3db97e ("net: ipv4: add support for ECMP hash policy choice") 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/route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7f08a30256c5..ade6cb309c40 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2048,7 +2048,7 @@ int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
struct flow_keys hash_keys;
u32 mhash = 0;
- switch (net->ipv4.sysctl_fib_multipath_hash_policy) {
+ switch (READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_policy)) {
case 0:
memset(&hash_keys, 0, sizeof(hash_keys));
hash_keys.control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;