diff options
| author | Steffen Klassert <steffen.klassert@secunet.com> | 2013-10-01 05:33:59 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-10-01 12:42:16 -0400 |
| commit | 3e08f4a72f689c6296d336c2aab4bddd60c93ae2 (patch) | |
| tree | 726a51f17de026da0e7c0135f827d529a406fcfd /net | |
| parent | e024bdc051ab99eafb5dd9bad87e79afc27f8a44 (diff) | |
ip_tunnel: Fix a memory corruption in ip_tunnel_xmit
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>
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/ip_tunnel.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index d3fbad422e0e..dfc6d8a3caa7 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, | |||
| 642 | 642 | ||
| 643 | max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr) | 643 | max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr) |
| 644 | + rt->dst.header_len; | 644 | + rt->dst.header_len; |
| 645 | if (max_headroom > dev->needed_headroom) { | 645 | if (max_headroom > dev->needed_headroom) |
| 646 | dev->needed_headroom = max_headroom; | 646 | dev->needed_headroom = max_headroom; |
| 647 | if (skb_cow_head(skb, dev->needed_headroom)) { | 647 | |
| 648 | dev->stats.tx_dropped++; | 648 | if (skb_cow_head(skb, dev->needed_headroom)) { |
| 649 | dev_kfree_skb(skb); | 649 | dev->stats.tx_dropped++; |
| 650 | return; | 650 | dev_kfree_skb(skb); |
| 651 | } | 651 | return; |
| 652 | } | 652 | } |
| 653 | 653 | ||
| 654 | err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol, | 654 | err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol, |
