net: Fix data-races around sysctl_optmem_max.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 23 Aug 2022 17:46:49 +0000 (10:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Aug 2022 15:16:43 +0000 (17:16 +0200)
commitd39a02760bf2c87e1a652e7b607a29436fd21762
tree1b45940af54bbbc563886d7951ca18289e594159
parent0db9ce822f13634e8042405684870da75747005f
net: Fix data-races around sysctl_optmem_max.

[ Upstream commit 7de6d09f51917c829af2b835aba8bb5040f8e86a ]

While reading sysctl_optmem_max, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its readers.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
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>
net/core/bpf_sk_storage.c
net/core/filter.c
net/core/sock.c
net/ipv4/ip_sockglue.c
net/ipv6/ipv6_sockglue.c