netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit
@ 2013-09-25  5:54 Steffen Klassert
  2013-09-25  5:55 ` [PATCH net 2/2] ip_tunnel: Add fallback tunnels to the hash lists Steffen Klassert
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Steffen Klassert @ 2013-09-25  5:54 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

We might extend the used aera of a skb beyond the total
headroom when we install the ipip header. Fix this by
calling skb_cow_head() unconditionally.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/ipv4/ip_tunnel.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index ac9fabe..b8ce640 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -641,13 +641,13 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
 
 	max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr)
 			+ rt->dst.header_len;
-	if (max_headroom > dev->needed_headroom) {
+	if (max_headroom > dev->needed_headroom)
 		dev->needed_headroom = max_headroom;
-		if (skb_cow_head(skb, dev->needed_headroom)) {
-			dev->stats.tx_dropped++;
-			dev_kfree_skb(skb);
-			return;
-		}
+
+	if (skb_cow_head(skb, dev->needed_headroom)) {
+		dev->stats.tx_dropped++;
+		dev_kfree_skb(skb);
+		return;
 	}
 
 	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2013-10-01  5:15 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25  5:54 [PATCH net 1/2] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit Steffen Klassert
2013-09-25  5:55 ` [PATCH net 2/2] ip_tunnel: Add fallback tunnels to the hash lists Steffen Klassert
2013-09-25 16:03   ` Pravin Shelar
2013-09-26  8:13     ` Steffen Klassert
2013-09-26 18:24       ` Pravin Shelar
2013-09-27  7:56         ` Steffen Klassert
2013-09-28  2:40           ` Pravin Shelar
2013-09-25 11:56 ` [PATCH net 1/2] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit Eric Dumazet
2013-09-25 12:13   ` Steffen Klassert
2013-09-25 12:44     ` Eric Dumazet
2013-09-25 16:55 ` Pravin Shelar
2013-09-26  8:25   ` Steffen Klassert
2013-09-26 18:25     ` Pravin Shelar
2013-09-27  7:45       ` Steffen Klassert
2013-09-28  2:34         ` Pravin Shelar
2013-09-30 18:40           ` David Miller
2013-10-01  5:15             ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).