diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-07-15 10:17:47 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-07-18 12:21:54 +0100 |
commit | f2e383b5bb6bbc60a0b94b87b3e49a2b1aefd11e (patch) | |
tree | d086482c4486c23c9ea6ebeb523b1251872086d4 /net/ipv6 | |
parent | 20a3b1c0f603e8c55c3396abd12dfcfb523e4d3c (diff) |
tcp: Fix data-races around sysctl_tcp_syncookies.
While reading sysctl_tcp_syncookies, 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>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/syncookies.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 9cc123f000fb..5014aa663452 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c @@ -141,7 +141,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) __u8 rcv_wscale; u32 tsoff = 0; - if (!sock_net(sk)->ipv4.sysctl_tcp_syncookies || !th->ack || th->rst) + if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_syncookies) || + !th->ack || th->rst) goto out; if (tcp_synq_no_recent_overflow(sk)) |