From 386d5303258ac9d5e8812a5fca2828ef4037f5cb Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 22 Sep 2020 10:13:08 +0800 Subject: [PATCH] tcp: clear tp->segs_{in|out} in tcp_disconnect() stable inclusion from linux-4.19.103 commit 7e23f798afdc70774fb5447d9db364da558eb457 -------------------------------- [ Upstream commit 784f8344de750a41344f4bbbebb8507a730fc99c ] tp->segs_in and tp->segs_out need to be cleared in tcp_disconnect(). tcp_disconnect() is rarely used, but it is worth fixing it. Fixes: 2efd055c53c0 ("tcp: add tcpi_segs_in and tcpi_segs_out to tcp_info") Signed-off-by: Eric Dumazet Cc: Marcelo Ricardo Leitner Cc: Yuchung Cheng Cc: Neal Cardwell Acked-by: Neal Cardwell Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Signed-off-by: Yang Yingliang Signed-off-by: Li Aichun Reviewed-by: guodeqing Signed-off-by: Yang Yingliang --- net/ipv4/tcp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 3c6664a74f89..34fda81c7db0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2605,6 +2605,8 @@ int tcp_disconnect(struct sock *sk, int flags) sk->sk_rx_dst = NULL; tcp_saved_syn_free(tp); tp->compressed_ack = 0; + tp->segs_in = 0; + tp->segs_out = 0; tp->bytes_sent = 0; tp->bytes_acked = 0; tp->bytes_received = 0; -- GitLab