Skip to content

Commit b2d8d14

Browse files
edumazetgregkh
authored andcommitted
tcp: initialize tp->copied_seq in case of cross SYN connection
[ Upstream commit 142a2e7 ] 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 <[email protected]> Reported-by: Dmitry Vyukov <[email protected]> Tested-by: Dmitry Vyukov <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 11617ee commit b2d8d14

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv4/tcp_input.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5659,6 +5659,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
56595659
}
56605660

56615661
tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
5662+
tp->copied_seq = tp->rcv_nxt;
56625663
tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1;
56635664

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

0 commit comments

Comments
 (0)