aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2013-10-01 05:33:59 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-13 19:08:30 -0400
commit23d6f8dd1cc9ca2a3aaed9c6bb24f80b39e071df (patch)
tree9eff8a12a85b9916789890ba2368100337d562f5
parentc7bd0696131d1cc596afea05d06c6fee5b7a51ca (diff)
ip_tunnel: Fix a memory corruption in ip_tunnel_xmit
[ Upstream commit 3e08f4a72f689c6296d336c2aab4bddd60c93ae2 ] 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/ipv4/ip_tunnel.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index b7a4c21c06ec..92d2f0f5d7bf 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -659,13 +659,13 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
659 659
660 max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(struct iphdr) 660 max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(struct iphdr)
661 + rt->dst.header_len; 661 + rt->dst.header_len;
662 if (max_headroom > dev->needed_headroom) { 662 if (max_headroom > dev->needed_headroom)
663 dev->needed_headroom = max_headroom; 663 dev->needed_headroom = max_headroom;
664 if (skb_cow_head(skb, dev->needed_headroom)) { 664
665 dev->stats.tx_dropped++; 665 if (skb_cow_head(skb, dev->needed_headroom)) {
666 dev_kfree_skb(skb); 666 dev->stats.tx_dropped++;
667 return; 667 dev_kfree_skb(skb);
668 } 668 return;
669 } 669 }
670 670
671 skb_dst_drop(skb); 671 skb_dst_drop(skb);