diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-18 10:26:43 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-29 17:25:22 +0200 |
commit | 3f2ac2d6511bb0652abf4d7388d65bb9ff1c641c (patch) | |
tree | 3d334fde9e462c57e9b748bff35db69587e5b09a /include/net | |
parent | 95724fe897a4ecf2be51452ef96e818568071664 (diff) |
udp: Fix a data-race around sysctl_udp_l3mdev_accept.
[ Upstream commit 3d72bb4188c708bb16758c60822fc4dda7a95174 ]
While reading sysctl_udp_l3mdev_accept, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its reader.
Fixes: 63a6fff353d0 ("net: Avoid receiving packets with an l3mdev on unbound UDP sockets")
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 'include/net')
-rw-r--r-- | include/net/udp.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/udp.h b/include/net/udp.h index 909ecf447e0f..438b1b01a56c 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -262,7 +262,7 @@ static inline bool udp_sk_bound_dev_eq(struct net *net, int bound_dev_if, int dif, int sdif) { #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) - return inet_bound_dev_eq(!!net->ipv4.sysctl_udp_l3mdev_accept, + return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_udp_l3mdev_accept), bound_dev_if, dif, sdif); #else return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); |