diff options
| author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-18 10:26:42 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-29 17:25:22 +0200 |
| commit | 95724fe897a4ecf2be51452ef96e818568071664 (patch) | |
| tree | 4c5142056d2601d6818cc82d4fea5c92444c06da /include | |
| parent | 36f5b86f309b3b11295d087cd7433f1c897caf94 (diff) | |
| download | linux-95724fe897a4ecf2be51452ef96e818568071664.tar.gz linux-95724fe897a4ecf2be51452ef96e818568071664.tar.bz2 linux-95724fe897a4ecf2be51452ef96e818568071664.zip | |
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')
| -rw-r--r-- | include/net/ip.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index a0ac57af82dc..8462ced0c21e 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 |
