Patch "netfilter: xt_TCPMSS: add more sanity tests on tcph->doff" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
netfilter: xt_TCPMSS: add more sanity tests on tcph->doff
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:
netfilter-xt_tcpmss-add-more-sanity-tests-on-tcph-doff.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
2638fd0f92d4397884fd991d8f4925cb3f081901Mon Sep 17 00:00:00 2001
From: Eric Dumazet <[email protected]>
Date: Mon, 3 Apr 2017 10:55:11 -0700
Subject: netfilter: xt_TCPMSS: add more sanity tests on tcph->doff
From: Eric Dumazet <[email protected]>
commit 2638fd0f92d4397884fd991d8f4925cb3f081901 upstream.
Denys provided an awesome KASAN report pointing to an use after free in xt_TCPMSS
I have provided three patches to fix this issue, either in xt_TCPMSS or in xt_tcpudp.c. It seems xt_TCPMSS patch has the smallest possible impact.
--- net/netfilter/xt_TCPMSS.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/netfilter/xt_TCPMSS.c +5 -1
@@ -104,7 +104,7 @@ tcpmss_mangle_packet(struct sk_buff *skb tcph = (struct tcphdr *)(skb_network_header (skb) + tcphoff); tcp_hdrlen = tcph->doff *4 ; -if (len < tcp_hdrlen) +if (len < tcp_hdrlen || tcp_hdrlen <sizeof (struct tcphdr ))return -1 ;if (info->mss ==XT_TCPMSS_CLAMP_PMTU ) {
@@ -152,6 +152,10 @@ tcpmss_mangle_packet(struct sk_buff *skbif (len > tcp_hdrlen)return 0 ; +/* tcph->doff has 4 bits, do not wrap it to 0 */ +if (tcp_hdrlen >=15 *4 ) +return 0 ; +/* * MSS Option not found ?! add it.. */
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/fix-an-intermittent-pr_emerg-warning-about-lo-becoming-free.patch queue-4.9/netfilter-xt_tcpmss-add-more-sanity-tests-on-tcph-doff.patch queue-4.9/ipv6-release-dst-on-error-in-ip6_dst_lookup_tail.patch queue-4.9/igmp-acquire-pmc-lock-for-ip_mc_clear_src.patch