summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Paasch <cpaasch@apple.com>2019-07-06 16:13:07 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-28 08:28:33 +0200
commit2527ea8f115cdd0b1e8fc5cb161ff7d1a7a99351 (patch)
tree4c746b9c6e290736b1609aa1e3d1360eac05face
parentdfc9148309629cd5c1f8252153496195dfc31045 (diff)
downloadlinux-stable-2527ea8f115cdd0b1e8fc5cb161ff7d1a7a99351.tar.gz
linux-stable-2527ea8f115cdd0b1e8fc5cb161ff7d1a7a99351.tar.bz2
linux-stable-2527ea8f115cdd0b1e8fc5cb161ff7d1a7a99351.zip
tcp: Reset bytes_acked and bytes_received when disconnecting
[ Upstream commit e858faf556d4e14c750ba1e8852783c6f9520a0e ] If an app is playing tricks to reuse a socket via tcp_disconnect(), bytes_acked/received needs to be reset to 0. Otherwise tcp_info will report the sum of the current and the old connection.. Cc: Eric Dumazet <edumazet@google.com> Fixes: 0df48c26d841 ("tcp: add tcpi_bytes_acked to tcp_info") Fixes: bdd1f9edacb5 ("tcp: add tcpi_bytes_received to tcp_info") Signed-off-by: Christoph Paasch <cpaasch@apple.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/ipv4/tcp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 05fa7b7aee1e..caac580e1f1d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2630,6 +2630,8 @@ int tcp_disconnect(struct sock *sk, int flags)
tcp_saved_syn_free(tp);
tp->compressed_ack = 0;
tp->bytes_sent = 0;
+ tp->bytes_acked = 0;
+ tp->bytes_received = 0;
tp->bytes_retrans = 0;
tp->duplicate_sack[0].start_seq = 0;
tp->duplicate_sack[0].end_seq = 0;