tcp: enforce tcp_min_snd_mss in tcp_mtu_probing()
authorEric Dumazet <edumazet@google.com>
Sat, 8 Jun 2019 17:22:49 +0000 (10:22 -0700)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 20 Jul 2019 23:59:12 +0000 (02:59 +0300)
commit 967c05aee439e6e5d7d805e195b3a20ef5c433d6 upstream.

If mtu probing is enabled tcp_mtu_probing() could very well end up
with a too small MSS.

Use the new sysctl tcp_min_snd_mss to make sure MSS search
is performed in an acceptable range.

CVE-2019-11479 -- tcp mss hardcoded to 48

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Jonathan Looney <jtl@netflix.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Bruce Curtis <brucec@netflix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Salvatore Bonaccorso: Backport for context changes in 4.9.168]
[bwh: Backported to 3.16: The sysctl is global]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv4/tcp_timer.c

index 2e0f0af..7f2eb80 100644 (file)
@@ -127,6 +127,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk)
                        mss = tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_low) >> 1;
                        mss = min(sysctl_tcp_base_mss, mss);
                        mss = max(mss, 68 - tp->tcp_header_len);
+                       mss = max(mss, sysctl_tcp_min_snd_mss);
                        icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, mss);
                        tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
                }