]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
tcp: clear tp->segs_{in|out} in tcp_disconnect()
authorEric Dumazet <edumazet@google.com>
Fri, 31 Jan 2020 18:44:50 +0000 (10:44 -0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 13 Mar 2020 04:31:00 +0000 (00:31 -0400)
BugLink: https://bugs.launchpad.net/bugs/1866678
[ 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 <edumazet@google.com>
Cc: Marcelo Ricardo Leitner <mleitner@redhat.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/ipv4/tcp.c

index 046138e091156d964338f1f8f3aa3d686f97a3d1..24e045dac64ae2b6eee058891315983b6498f0a4 100644 (file)
@@ -2435,6 +2435,8 @@ int tcp_disconnect(struct sock *sk, int flags)
        dst_release(sk->sk_rx_dst);
        sk->sk_rx_dst = NULL;
        tcp_saved_syn_free(tp);
+       tp->segs_in = 0;
+       tp->segs_out = 0;
        tp->bytes_acked = 0;
        tp->bytes_received = 0;
        tp->data_segs_in = 0;