Skip to content

Commit abb4a8b

Browse files
soheilhygregkh
authored andcommitted
tcp: purge write queue upon RST
[ Upstream commit a27fd7a ] 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent eec434c commit abb4a8b

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
@@ -4011,6 +4011,7 @@ void tcp_reset(struct sock *sk)
40114011
/* This barrier is coupled with smp_rmb() in tcp_poll() */
40124012
smp_wmb();
40134013

4014+
tcp_write_queue_purge(sk);
40144015
tcp_done(sk);
40154016

40164017
if (!sock_flag(sk, SOCK_DEAD))

0 commit comments

Comments
 (0)