mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 05:27:07 +02:00
tcp: Fix a data-race around sysctl_tcp_max_orphans.
[ Upstream commit47e6ab24e8] While reading sysctl_tcp_max_orphans, it can be changed concurrently. So, we need to add READ_ONCE() to avoid a data-race. Fixes:1da177e4c3("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>
This commit is contained in:
parent
609ce7ff75
commit
6481a8a72a
|
|
@ -2490,7 +2490,8 @@ static void tcp_orphan_update(struct timer_list *unused)
|
||||||
|
|
||||||
static bool tcp_too_many_orphans(int shift)
|
static bool tcp_too_many_orphans(int shift)
|
||||||
{
|
{
|
||||||
return READ_ONCE(tcp_orphan_cache) << shift > sysctl_tcp_max_orphans;
|
return READ_ONCE(tcp_orphan_cache) << shift >
|
||||||
|
READ_ONCE(sysctl_tcp_max_orphans);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tcp_check_oom(struct sock *sk, int shift)
|
bool tcp_check_oom(struct sock *sk, int shift)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user