summaryrefslogtreecommitdiff
path: root/include/net/ip.h
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@amazon.com>2022-07-18 20:26:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-29 18:19:20 +0300
commit9add240f76af6d141d2eebd3a1558a0e503a993d (patch)
tree4814608b57fcf986a02d3fb67f1b46b138da7729 /include/net/ip.h
parente045d672ba06e1d35bacb56374d350de0ac99066 (diff)
downloadlinux-9add240f76af6d141d2eebd3a1558a0e503a993d.tar.xz
ip: Fix data-races around sysctl_ip_prot_sock.
[ Upstream commit 9b55c20f83369dd54541d9ddbe3a018a8377f451 ] sysctl_ip_prot_sock is accessed concurrently, and there is always a chance of data-race. So, all readers and writers need some basic protection to avoid load/store-tearing. Fixes: 4548b683b781 ("Introduce a sysctl that modifies the value of PROT_SOCK.") 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/ip.h')
-rw-r--r--include/net/ip.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index d715b25a8dc4..c5822d7824cd 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -352,7 +352,7 @@ static inline bool sysctl_dev_name_is_allowed(const char *name)
static inline bool inet_port_requires_bind_service(struct net *net, unsigned short port)
{
- return port < net->ipv4.sysctl_ip_prot_sock;
+ return port < READ_ONCE(net->ipv4.sysctl_ip_prot_sock);
}
#else