Skip to content

Commit 413d262

Browse files
yuchungchenggregkh
authored andcommitted
tcp: ignore Fast Open on repair mode
[ Upstream commit 16ae6aa ] The TCP repair sequence of operation is to first set the socket in repair mode, then inject the TCP stats into the socket with repair socket options, then call connect() to re-activate the socket. The connect syscall simply returns and set state to ESTABLISHED mode. As a result Fast Open is meaningless for TCP repair. However allowing sendto() system call with MSG_FASTOPEN flag half-way during the repair operation could unexpectedly cause data to be sent, before the operation finishes changing the internal TCP stats (e.g. MSS). This in turn triggers TCP warnings on inconsistent packet accounting. The fix is to simply disallow Fast Open operation once the socket is in the repair mode. Reported-by: syzbot <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Reviewed-by: Neal Cardwell <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3cfe95a commit 413d262

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv4/tcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
11941194
uarg->zerocopy = 0;
11951195
}
11961196

1197-
if (unlikely(flags & MSG_FASTOPEN || inet_sk(sk)->defer_connect)) {
1197+
if (unlikely(flags & MSG_FASTOPEN || inet_sk(sk)->defer_connect) &&
1198+
!tp->repair) {
11981199
err = tcp_sendmsg_fastopen(sk, msg, &copied_syn, size);
11991200
if (err == -EINPROGRESS && copied_syn > 0)
12001201
goto out;

0 commit comments

Comments
 (0)