tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0
authorWei Wang <weiwan@google.com>
Thu, 18 May 2017 18:22:33 +0000 (11:22 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 15 Sep 2017 17:30:56 +0000 (18:30 +0100)
commit16a0303d3f6b222044de5d33c01cbdf590050473
treeedfb3421caf455eea5979de3d44e82930823e1c8
parent7903b0f95be453f651a589f0f468d145592110b2
tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0

commit 499350a5a6e7512d9ed369ed63a4244b6536f4f8 upstream.

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: Ben Hutchings <ben@decadent.org.uk>
net/ipv4/tcp.c