* [PATCH net] tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0
@ 2017-05-18 18:22 Wei Wang
2017-05-21 17:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wei Wang @ 2017-05-18 18:22 UTC (permalink / raw)
To: David Miller, netdev; +Cc: Yuchung Cheng, Neal Cardwell, Eric Dumazet, Wei Wang
From: Wei Wang <weiwan@google.com>
When tcp_disconnect() is called, inet_csk_delack_init() sets
icsk->icsk_ack.rcv_mss to 0.
This could potentially cause tcp_recvmsg() => tcp_cleanup_rbuf() =>
__tcp_select_window() call path to have division by 0 issue.
So this patch initializes rcv_mss to TCP_MIN_MSS instead of 0.
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
---
net/ipv4/tcp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1e4c76d2b827..842b575f8fdd 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2320,6 +2320,10 @@ int tcp_disconnect(struct sock *sk, int flags)
tcp_set_ca_state(sk, TCP_CA_Open);
tcp_clear_retrans(tp);
inet_csk_delack_init(sk);
+ /* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 0
+ * issue in __tcp_select_window()
+ */
+ icsk->icsk_ack.rcv_mss = TCP_MIN_MSS;
tcp_init_send_head(sk);
memset(&tp->rx_opt, 0, sizeof(tp->rx_opt));
__sk_dst_reset(sk);
--
2.13.0.303.g4ebf302169-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0
2017-05-18 18:22 [PATCH net] tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0 Wei Wang
@ 2017-05-21 17:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-21 17:25 UTC (permalink / raw)
To: weiwan; +Cc: netdev, ycheng, ncardwell, edumazet
From: Wei Wang <weiwan@google.com>
Date: Thu, 18 May 2017 11:22:33 -0700
> From: Wei Wang <weiwan@google.com>
>
> When tcp_disconnect() is called, inet_csk_delack_init() sets
> icsk->icsk_ack.rcv_mss to 0.
> This could potentially cause tcp_recvmsg() => tcp_cleanup_rbuf() =>
> __tcp_select_window() call path to have division by 0 issue.
> So this patch initializes rcv_mss to TCP_MIN_MSS instead of 0.
>
> Reported-by: Andrey Konovalov <andreyknvl@google.com>
> Signed-off-by: Wei Wang <weiwan@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-21 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18 18:22 [PATCH net] tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0 Wei Wang
2017-05-21 17:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox