Skip to content

Commit 364e03f

Browse files
cpaaschgregkh
authored andcommitted
tcp: Reset bytes_acked and bytes_received when disconnecting
[ Upstream commit e858faf ] 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: 0df48c2 ("tcp: add tcpi_bytes_acked to tcp_info") Fixes: bdd1f9e ("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>
1 parent 6870759 commit 364e03f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/ipv4/tcp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,8 @@ int tcp_disconnect(struct sock *sk, int flags)
22722272
dst_release(sk->sk_rx_dst);
22732273
sk->sk_rx_dst = NULL;
22742274
tcp_saved_syn_free(tp);
2275+
tp->bytes_acked = 0;
2276+
tp->bytes_received = 0;
22752277

22762278
WARN_ON(inet->inet_num && !icsk->icsk_bind_hash);
22772279

0 commit comments

Comments
 (0)