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