netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 1/4] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit
@ 2013-10-01  9:33 Steffen Klassert
  2013-10-01  9:34 ` [PATCH net v2 2/4] ip_tunnel: Add fallback tunnels to the hash lists Steffen Klassert
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Steffen Klassert @ 2013-10-01  9:33 UTC (permalink / raw)
  To: David Miller; +Cc: Pravin Shelar, 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.

Bug was introduced with commit c544193214
("GRE: Refactor GRE tunneling code.")

Cc: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---

v2: Add a reference to the commit that introduced bug to the commit message

 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 d3fbad4..dfc6d8a 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -642,13 +642,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] 23+ messages in thread

end of thread, other threads:[~2013-10-22  7:34 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01  9:33 [PATCH net v2 1/4] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit Steffen Klassert
2013-10-01  9:34 ` [PATCH net v2 2/4] ip_tunnel: Add fallback tunnels to the hash lists Steffen Klassert
2013-10-01 16:43   ` David Miller
2013-10-01  9:35 ` [PATCH net 3/4] ip_tunnel_core: Change __skb_push back to skb_push Steffen Klassert
2013-10-01 16:43   ` David Miller
2013-10-01  9:37 ` [PATCH net 4/4] ip_tunnel: Remove double unregister of the fallback device Steffen Klassert
2013-10-01 10:00   ` Nicolas Dichtel
2013-10-01 10:40     ` Steffen Klassert
2013-10-01 11:30       ` Nicolas Dichtel
2013-10-01 16:04         ` [PATCH net 1/2] sit: allow to use rtnl ops on fb tunnel Nicolas Dichtel
2013-10-01 16:05           ` [PATCH net 2/2] ip6tnl: " Nicolas Dichtel
2013-10-01 16:59             ` David Miller
2013-10-02  7:16               ` Nicolas Dichtel
2013-10-01 16:59           ` [PATCH net 1/2] sit: " David Miller
2013-10-02  7:15             ` Nicolas Dichtel
2013-10-02  7:36               ` Nicolas Dichtel
2013-10-02 21:08                 ` David Miller
2013-10-03  8:06                   ` Nicolas Dichtel
2013-10-03 17:37                     ` David Miller
2013-10-21 23:30               ` Willem de Bruijn
2013-10-22  7:34                 ` Nicolas Dichtel
2013-10-01 16:43   ` [PATCH net 4/4] ip_tunnel: Remove double unregister of the fallback device David Miller
2013-10-01 16:43 ` [PATCH net v2 1/4] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit David Miller

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).