diff options
author | Wei Wang <weiwan@google.com> | 2017-05-18 11:22:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-09-27 10:57:18 +0200 |
commit | 1722ca90e1b88e6b7f0824908828e2462d7405ac (patch) | |
tree | 7b823a06561857d3841ea04325133583522a3302 | |
parent | 39194a40eef5a4771404ea04910b8216f8d2a065 (diff) | |
download | linux-stable-1722ca90e1b88e6b7f0824908828e2462d7405ac.tar.gz linux-stable-1722ca90e1b88e6b7f0824908828e2462d7405ac.tar.bz2 linux-stable-1722ca90e1b88e6b7f0824908828e2462d7405ac.zip |
tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0
[ Upstream commit 499350a5a6e7512d9ed369ed63a4244b6536f4f8 ]
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/ipv4/tcp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 458a4c046784..567f8860e722 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2265,6 +2265,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); |