Commit 91269e390d062b526432f2ef1352b8df82e0e0bc

Authored by Li RongQing
Committed by David S. Miller
1 parent ce6502a8f9

vxlan: using pskb_may_pull as early as possible

pskb_may_pull should be used to check if skb->data has enough space,
skb->len can not ensure that.

Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff

... ... @@ -1437,9 +1437,6 @@
1437 1437 if (!in6_dev)
1438 1438 goto out;
1439 1439  
1440   - if (!pskb_may_pull(skb, skb->len))
1441   - goto out;
1442   -
1443 1440 iphdr = ipv6_hdr(skb);
1444 1441 saddr = &iphdr->saddr;
1445 1442 daddr = &iphdr->daddr;
... ... @@ -1880,7 +1877,8 @@
1880 1877 return arp_reduce(dev, skb);
1881 1878 #if IS_ENABLED(CONFIG_IPV6)
1882 1879 else if (ntohs(eth->h_proto) == ETH_P_IPV6 &&
1883   - skb->len >= sizeof(struct ipv6hdr) + sizeof(struct nd_msg) &&
  1880 + pskb_may_pull(skb, sizeof(struct ipv6hdr)
  1881 + + sizeof(struct nd_msg)) &&
1884 1882 ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {
1885 1883 struct nd_msg *msg;
1886 1884