netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: clear tp->segs_{in|out} in tcp_disconnect()
@ 2020-01-31 18:44 Eric Dumazet
  2020-01-31 19:49 ` Neal Cardwell
  2020-02-01  6:22 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2020-01-31 18:44 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, Neal Cardwell, Eric Dumazet, Eric Dumazet,
	Marcelo Ricardo Leitner, Yuchung Cheng

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>
---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 3b601823f69a93dd20f9a4876945a87cd2196dc9..eb2d80519f8e5ad165ca3b8acef2b10bdf8b7345 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2639,6 +2639,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;
-- 
2.25.0.341.g760bfbb309-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: clear tp->segs_{in|out} in tcp_disconnect()
  2020-01-31 18:44 [PATCH net] tcp: clear tp->segs_{in|out} in tcp_disconnect() Eric Dumazet
@ 2020-01-31 19:49 ` Neal Cardwell
  2020-02-01  6:22 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2020-01-31 19:49 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, netdev, Eric Dumazet, Marcelo Ricardo Leitner,
	Yuchung Cheng

On Fri, Jan 31, 2020 at 1:44 PM Eric Dumazet <edumazet@google.com> wrote:
>
> 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>
> ---
>  net/ipv4/tcp.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 3b601823f69a93dd20f9a4876945a87cd2196dc9..eb2d80519f8e5ad165ca3b8acef2b10bdf8b7345 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2639,6 +2639,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;
> --

Thanks, Eric!

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: clear tp->segs_{in|out} in tcp_disconnect()
  2020-01-31 18:44 [PATCH net] tcp: clear tp->segs_{in|out} in tcp_disconnect() Eric Dumazet
  2020-01-31 19:49 ` Neal Cardwell
@ 2020-02-01  6:22 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-02-01  6:22 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, netdev, Neal Cardwell, Eric Dumazet,
	Marcelo Ricardo Leitner, Yuchung Cheng

On Fri, 31 Jan 2020 10:44:50 -0800, Eric Dumazet wrote:
> 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>

Applied all 4 disconnect fixes, and queued them for stable. 

Thank you!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-01  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 18:44 [PATCH net] tcp: clear tp->segs_{in|out} in tcp_disconnect() Eric Dumazet
2020-01-31 19:49 ` Neal Cardwell
2020-02-01  6:22 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).