Skip to contentSkip to conversation

Patch "tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Sep 15, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tcp-initialize-rcv_mss-to-tcp_min_mss-instead-of-0.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Sep 14 23:20:08 PDT 2017

From: Wei Wang <[email protected]>
Date: Thu, 18 May 2017 11:22:33 -0700
Subject: tcp: initialize rcv_mss to TCP_MIN_MSS instead of 0

From: Wei Wang <[email protected]>

[ 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.

---
 net/ipv4/tcp.c |    4 ++++
 1 file changed, 4 insertions(+)
net/ipv4/tcp.c +4 -0
@@ -2297,6 +2297,10 @@ int tcp_disconnect(struct sock *sk, int
 	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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/ipv6-fix-sparse-warning-on-rt6i_node.patch queue-4.9/tcp-initialize-rcv_mss-to-tcp_min_mss-instead-of-0.patch queue-4.9/ipv6-add-rcu-grace-period-before-freeing-fib6_node.patch