Patch "ipv6: avoid write to a possibly cloned skb" 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
ipv6: avoid write to a possibly cloned skb
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:
ipv6-avoid-write-to-a-possibly-cloned-skb.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 Sat Mar 18 22:03:25 CST 2017
From: Florian Westphal <[email protected]>
Date: Mon, 13 Mar 2017 16:24:28 +0100
Subject: ipv6: avoid write to a possibly cloned skb
From: Florian Westphal <[email protected]>
[ Upstream commit 79e49503efe53a8c51d8b695bedc8a346c5e4a87 ]
ip6_fragment, in case skb has a fraglist, checks if the
skb is cloned. If it is, it will move to the 'slow path' and allocates new skbs for each fragment.
However, right before entering the slowpath loop, it updates the nexthdr value of the last ipv6 extension header to NEXTHDR_FRAGMENT, to account for the fragment header that will be inserted in the new ipv6-fragment skbs.
In case original skb is cloned this munges nexthdr value of another skb. Avoid this by doing the nexthdr update for each of the new fragment skbs separately.
This was observed with tcpdump on a bridge device where netfilter ipv6 reassembly is active: tcpdump shows malformed fragment headers as the l4 header (icmpv6, tcp, etc). is decoded as a fragment header.
--- net/ipv6/ip6_output.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv6/ip6_output.c +6 -1
@@ -757,13 +757,14 @@ slow_path:* Fragment the datagram. */ - *prevhdr =NEXTHDR_FRAGMENT ; troom = rt->dst.dev->needed_tailroom;/* * Keep copying data until we run out. */ while (left >0 ) { +u8 *fragnexthdr_offset; + len = left;/* IF: it doesn't fit, use 'mtu' - the data space left */ if (len > mtu)
@@ -808,6 +809,10 @@ slow_path:*/ skb_copy_from_linear_data (skb,skb_network_header (frag), hlen); + fragnexthdr_offset =skb_network_header (frag); + fragnexthdr_offset += prevhdr -skb_network_header (skb); + *fragnexthdr_offset =NEXTHDR_FRAGMENT ; +/* * Build fragment header. */
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/ipv6-avoid-write-to-a-possibly-cloned-skb.patch queue-4.9/bridge-drop-netfilter-fake-rtable-unconditionally.patch