tcp: annotate data-race around queue->synflood_warned
authorEric Dumazet <edumazet@google.com>
Tue, 15 Nov 2022 09:18:51 +0000 (09:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Nov 2022 13:32:53 +0000 (13:32 +0000)
Annotate the lockless read of queue->synflood_warned.

Following xchg() has the needed data-race resolution.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c

index 94024fd..0ae291e 100644 (file)
@@ -6841,7 +6841,7 @@ static bool tcp_syn_flood_action(const struct sock *sk, const char *proto)
 #endif
                __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP);
 
-       if (!queue->synflood_warned && syncookies != 2 &&
+       if (!READ_ONCE(queue->synflood_warned) && syncookies != 2 &&
            xchg(&queue->synflood_warned, 1) == 0) {
                if (IS_ENABLED(CONFIG_IPV6) && sk->sk_family == AF_INET6) {
                        net_info_ratelimited("%s: Possible SYN flooding on port [%pI6c]:%u. %s.\n",