Skip to content

Commit a27fd7a

Browse files
soheilhydavem330
authored andcommitted
tcp: purge write queue upon RST
When the connection is reset, there is no point in keeping the packets on the write queue until the connection is closed. RFC 793 (page 70) and RFC 793-bis (page 64) both suggest purging the write queue upon RST: https://tools.ietf.org/html/draft-ietf-tcpm-rfc793bis-07 Moreover, this is essential for a correct MSG_ZEROCOPY implementation, because userspace cannot call close(fd) before receiving zerocopy signals even when the connection is reset. Fixes: f214f91 ("tcp: enable MSG_ZEROCOPY") Signed-off-by: Soheil Hassas Yeganeh <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 55e84dd commit a27fd7a

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
@@ -3992,6 +3992,7 @@ void tcp_reset(struct sock *sk)
39923992
/* This barrier is coupled with smp_rmb() in tcp_poll() */
39933993
smp_wmb();
39943994

3995+
tcp_write_queue_purge(sk);
39953996
tcp_done(sk);
39963997

39973998
if (!sock_flag(sk, SOCK_DEAD))

0 commit comments

Comments
 (0)