From: Li RongQing Date: Thu, 16 Oct 2014 01:17:18 +0000 (+0800) Subject: vxlan: using pskb_may_pull as early as possible X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6f75e2f9f7657c9462b2268c2ff97f93bfa2d3c8;p=karo-tx-linux.git vxlan: using pskb_may_pull as early as possible [ Upstream commit 91269e390d062b526432f2ef1352b8df82e0e0bc ] pskb_may_pull should be used to check if skb->data has enough space, skb->len can not ensure that. Cc: Cong Wang Signed-off-by: Li RongQing Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 3e35bc6d23a6..e1b4e00430ce 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1447,9 +1447,6 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) if (!in6_dev) goto out; - if (!pskb_may_pull(skb, skb->len)) - goto out; - iphdr = ipv6_hdr(skb); saddr = &iphdr->saddr; daddr = &iphdr->daddr; @@ -1979,7 +1976,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) return arp_reduce(dev, skb); #if IS_ENABLED(CONFIG_IPV6) else if (ntohs(eth->h_proto) == ETH_P_IPV6 && - skb->len >= sizeof(struct ipv6hdr) + sizeof(struct nd_msg) && + pskb_may_pull(skb, sizeof(struct ipv6hdr) + + sizeof(struct nd_msg)) && ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) { struct nd_msg *msg;