Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4a71b15 authored by Pravin B Shelar's avatar Pravin B Shelar Committed by David S. Miller
Browse files

ip_tunnel: Do not use stale inner_iph pointer.



While sending packet skb_cow_head() can change skb header which
invalidates inner_iph pointer to skb header. Following patch
avoid using it. Found by code inspection.

This bug was introduced by commit 0e6fbc5b (ip_tunnels: extend
iptunnel_xmit()).

Signed-off-by: default avatarPravin B Shelar <pshelar@nicira.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d77f343
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -623,6 +623,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
			tunnel->err_count = 0;
			tunnel->err_count = 0;
	}
	}


	tos = ip_tunnel_ecn_encap(tos, inner_iph, skb);
	ttl = tnl_params->ttl;
	ttl = tnl_params->ttl;
	if (ttl == 0) {
	if (ttl == 0) {
		if (skb->protocol == htons(ETH_P_IP))
		if (skb->protocol == htons(ETH_P_IP))
@@ -651,8 +652,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
	}
	}


	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol,
	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, protocol,
			    ip_tunnel_ecn_encap(tos, inner_iph, skb), ttl, df,
			    tos, ttl, df, !net_eq(tunnel->net, dev_net(dev)));
			    !net_eq(tunnel->net, dev_net(dev)));
	iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
	iptunnel_xmit_stats(err, &dev->stats, dev->tstats);


	return;
	return;