diff options
author | Christoph Paasch <cpaasch@apple.com> | 2019-07-06 16:13:07 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-04 09:33:35 +0200 |
commit | 01dd3672a1575fd8b2979ab34a77a5185514979f (patch) | |
tree | 5e867772ecce3e2dec8d7109dee951b7c4e99b2c /net/ipv4/tcp.c | |
parent | 227f0246c7a1a6d87211496f3e35c62f04595744 (diff) |
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>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index ee2822a411f9..6e25524c6a74 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2312,6 +2312,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->bytes_acked = 0; + tp->bytes_received = 0; WARN_ON(inet->inet_num && !icsk->icsk_bind_hash); |