tcp: use correct req pointer in tcp_move_syn() calls
authorEric Dumazet <edumazet@google.com>
Thu, 5 Nov 2015 20:50:19 +0000 (12:50 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Nov 2015 20:57:51 +0000 (15:57 -0500)
I mistakenly took wrong request sock pointer when calling tcp_move_syn()

@req_unhash is either a copy of @req, or a NULL value for
FastOpen connexions (as we do not expect to unhash the temporary
request sock from ehash table)

Fixes: 805c4bc05705 ("tcp: fix req->saved_syn race")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ying Cai <ycai@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c

index 59aff63b1776bef5c067adb254d764bfff487560..950e28c0cdf25e23658926cdcf37335aed3fb193 100644 (file)
@@ -1327,7 +1327,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
                goto put_and_exit;
        *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
        if (*own_req)
-               tcp_move_syn(newtp, req_unhash);
+               tcp_move_syn(newtp, req);
 
        return newsk;
 
index c509e5562429e3278618363682d13d071d21c804..5baa8e754e412c454ca22c03822cc57c29df8c35 100644 (file)
@@ -1141,7 +1141,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
        }
        *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
        if (*own_req) {
-               tcp_move_syn(newtp, req_unhash);
+               tcp_move_syn(newtp, req);
 
                /* Clone pktoptions received with SYN, if we own the req */
                if (ireq->pktopts) {