From 45f35dc844cb8b3a866ec347f8906653815a1b64 Mon Sep 17 00:00:00 2001 From: Julian Anastasov Date: Mon, 6 Oct 2003 18:32:54 -0700 Subject: [PATCH] [IPV4/IPV6]: Do not modify skb->h.raw until skb is unshared. --- net/ipv4/ip_gre.c | 3 +-- net/ipv4/ipip.c | 3 +-- net/ipv6/sit.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 5cd43a7bb5713..2ee1097dedf4b 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -803,8 +803,6 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) tunnel->err_count = 0; } - skb->h.raw = skb->nh.raw; - max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen; if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) { @@ -823,6 +821,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) old_iph = skb->nh.iph; } + skb->h.raw = skb->nh.raw; skb->nh.raw = skb_push(skb, gre_hlen); memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); dst_release(skb->dst); diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 92d75a2e14618..6f69aa521ffdf 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -601,8 +601,6 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) tunnel->err_count = 0; } - skb->h.raw = skb->nh.raw; - /* * Okay, now see if we can stuff it in the buffer as-is. */ @@ -624,6 +622,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) old_iph = skb->nh.iph; } + skb->h.raw = skb->nh.raw; skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); dst_release(skb->dst); diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 8576eda7d5f45..9d003767bb9f5 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -530,8 +530,6 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) tunnel->err_count = 0; } - skb->h.raw = skb->nh.raw; - /* * Okay, now see if we can stuff it in the buffer as-is. */ @@ -553,6 +551,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) iph6 = skb->nh.ipv6h; } + skb->h.raw = skb->nh.raw; skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); dst_release(skb->dst); -- 2.53.0