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