]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.133/tcp-ignore-fast-open-on-repair-mode.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.133 / tcp-ignore-fast-open-on-repair-mode.patch
1 From foo@baz Wed May 16 12:08:47 CEST 2018
2 From: Yuchung Cheng <ycheng@google.com>
3 Date: Wed, 25 Apr 2018 11:33:08 -0700
4 Subject: tcp: ignore Fast Open on repair mode
5
6 From: Yuchung Cheng <ycheng@google.com>
7
8 [ Upstream commit 16ae6aa1705299789f71fdea59bfb119c1fbd9c0 ]
9
10 The TCP repair sequence of operation is to first set the socket in
11 repair mode, then inject the TCP stats into the socket with repair
12 socket options, then call connect() to re-activate the socket. The
13 connect syscall simply returns and set state to ESTABLISHED
14 mode. As a result Fast Open is meaningless for TCP repair.
15
16 However allowing sendto() system call with MSG_FASTOPEN flag half-way
17 during the repair operation could unexpectedly cause data to be
18 sent, before the operation finishes changing the internal TCP stats
19 (e.g. MSS). This in turn triggers TCP warnings on inconsistent
20 packet accounting.
21
22 The fix is to simply disallow Fast Open operation once the socket
23 is in the repair mode.
24
25 Reported-by: syzbot <syzkaller@googlegroups.com>
26 Signed-off-by: Yuchung Cheng <ycheng@google.com>
27 Reviewed-by: Neal Cardwell <ncardwell@google.com>
28 Reviewed-by: Eric Dumazet <edumazet@google.com>
29 Signed-off-by: David S. Miller <davem@davemloft.net>
30 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31 ---
32 net/ipv4/tcp.c | 2 +-
33 1 file changed, 1 insertion(+), 1 deletion(-)
34
35 --- a/net/ipv4/tcp.c
36 +++ b/net/ipv4/tcp.c
37 @@ -1108,7 +1108,7 @@ int tcp_sendmsg(struct sock *sk, struct
38 lock_sock(sk);
39
40 flags = msg->msg_flags;
41 - if (flags & MSG_FASTOPEN) {
42 + if ((flags & MSG_FASTOPEN) && !tp->repair) {
43 err = tcp_sendmsg_fastopen(sk, msg, &copied_syn, size);
44 if (err == -EINPROGRESS && copied_syn > 0)
45 goto out;