It is not because a TCP listener is FastOpen ready that
all incoming sockets actually used FastOpen.
Avoid taking queue->fastopenq->lock if not needed.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
 {
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct request_sock_queue *queue = &icsk->icsk_accept_queue;
-       struct sock *newsk;
        struct request_sock *req;
+       struct sock *newsk;
        int error;
 
        lock_sock(sk);
        newsk = req->sk;
 
        sk_acceptq_removed(sk);
-       if (sk->sk_protocol == IPPROTO_TCP && queue->fastopenq != NULL) {
+       if (sk->sk_protocol == IPPROTO_TCP &&
+           tcp_rsk(req)->tfo_listener &&
+           queue->fastopenq) {
                spin_lock_bh(&queue->fastopenq->lock);
                if (tcp_rsk(req)->tfo_listener) {
                        /* We are still waiting for the final ACK from 3WHS