[3.16.y-ckt stable] Patch "tcp: initialize tp->copied_seq in case of cross SYN connection" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Mon Jan 4 17:31:28 UTC 2016


This is a note to let you know that I have just added a patch titled

    tcp: initialize tp->copied_seq in case of cross SYN connection

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt22.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 9a81e0e1dd6d5109dfbbaa808360d33ba9a509ad Mon Sep 17 00:00:00 2001
From: Eric Dumazet <edumazet at google.com>
Date: Thu, 26 Nov 2015 08:18:14 -0800
Subject: tcp: initialize tp->copied_seq in case of cross SYN connection

commit 142a2e7ece8d8ac0e818eb2c91f99ca894730e2a upstream.

Dmitry provided a syzkaller (http://github.com/google/syzkaller)
generated program that triggers the WARNING at
net/ipv4/tcp.c:1729 in tcp_recvmsg() :

WARN_ON(tp->copied_seq != tp->rcv_nxt &&
        !(flags & (MSG_PEEK | MSG_TRUNC)));

His program is specifically attempting a Cross SYN TCP exchange,
that we support (for the pleasure of hackers ?), but it looks we
lack proper tcp->copied_seq initialization.

Thanks again Dmitry for your report and testings.

Signed-off-by: Eric Dumazet <edumazet at google.com>
Reported-by: Dmitry Vyukov <dvyukov at google.com>
Tested-by: Dmitry Vyukov <dvyukov at google.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 net/ipv4/tcp_input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e3d40a303b8f..43404d3f9da8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5549,6 +5549,7 @@ discard:
 		}

 		tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
+		tp->copied_seq = tp->rcv_nxt;
 		tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1;

 		/* RFC1323: The window in SYN & SYN/ACK segments is




More information about the kernel-team mailing list