Unverified Commit f29c5237 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6611 net: ip_tunnel: make sure to pull inner header in ip_tunnel_rcv()

parents 220dd43f 239bc50b
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
{
	struct pcpu_sw_netstats *tstats;
	const struct iphdr *iph = ip_hdr(skb);
	int err;
	int nh, err;

#ifdef CONFIG_NET_IPGRE_BROADCAST
	if (ipv4_is_multicast(iph->daddr)) {
@@ -404,8 +404,21 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
		tunnel->i_seqno = ntohl(tpi->seq) + 1;
	}

	/* Save offset of outer header relative to skb->head,
	 * because we are going to reset the network header to the inner header
	 * and might change skb->head.
	 */
	nh = skb_network_header(skb) - skb->head;

	skb_reset_network_header(skb);

	if (!pskb_inet_may_pull(skb)) {
		DEV_STATS_INC(tunnel->dev, rx_length_errors);
		DEV_STATS_INC(tunnel->dev, rx_errors);
		goto drop;
	}
	iph = (struct iphdr *)(skb->head + nh);

	err = IP_ECN_decapsulate(iph, skb);
	if (unlikely(err)) {
		if (log_ecn_error)