cd2a7b7
Bugzilla: 1030015 1030017
cd2a7b7
Upstream-status: 3.13
cd2a7b7
cd2a7b7
From aeb45260747b0a1bf4d374d5e65298cc254cb4f5 Mon Sep 17 00:00:00 2001
cd2a7b7
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
cd2a7b7
Date: Tue, 5 Nov 2013 02:41:27 +0100
cd2a7b7
Subject: [PATCH] ipv6: fix headroom calculation in udp6_ufo_fragment
cd2a7b7
cd2a7b7
Commit 1e2bd517c108816220f262d7954b697af03b5f9c ("udp6: Fix udp
cd2a7b7
fragmentation for tunnel traffic.") changed the calculation if
cd2a7b7
there is enough space to include a fragment header in the skb from a
cd2a7b7
skb->mac_header dervived one to skb_headroom. Because we already peeled
cd2a7b7
off the skb to transport_header this is wrong. Change this back to check
cd2a7b7
if we have enough room before the mac_header.
cd2a7b7
cd2a7b7
This fixes a panic Saran Neti reported. He used the tbf scheduler which
cd2a7b7
skb_gso_segments the skb. The offsets get negative and we panic in memcpy
cd2a7b7
because the skb was erroneously not expanded at the head.
cd2a7b7
cd2a7b7
Reported-by: Saran Neti <Saran.Neti@telus.com>
cd2a7b7
Cc: Pravin B Shelar <pshelar@nicira.com>
cd2a7b7
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
cd2a7b7
Signed-off-by: David S. Miller <davem@davemloft.net>
cd2a7b7
---
cd2a7b7
 net/ipv6/udp_offload.c | 2 +-
cd2a7b7
 1 file changed, 1 insertion(+), 1 deletion(-)
cd2a7b7
cd2a7b7
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
cd2a7b7
index 5d1b8d7..657914b 100644
cd2a7b7
--- a/net/ipv6/udp_offload.c
cd2a7b7
+++ b/net/ipv6/udp_offload.c
cd2a7b7
@@ -86,7 +86,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
cd2a7b7
 
cd2a7b7
 	/* Check if there is enough headroom to insert fragment header. */
cd2a7b7
 	tnl_hlen = skb_tnl_header_len(skb);
cd2a7b7
-	if (skb_headroom(skb) < (tnl_hlen + frag_hdr_sz)) {
cd2a7b7
+	if (skb->mac_header < (tnl_hlen + frag_hdr_sz)) {
cd2a7b7
 		if (gso_pskb_expand_head(skb, tnl_hlen + frag_hdr_sz))
cd2a7b7
 			goto out;
cd2a7b7
 	}
cd2a7b7
-- 
cd2a7b7
1.8.3.1
cd2a7b7