Skip to content

Commit 91269e3

Browse files
Li RongQingdavem330
authored andcommitted
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>
1 parent ce6502a commit 91269e3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎drivers/net/vxlan.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,9 +1437,6 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)
14371437
if (!in6_dev)
14381438
goto out;
14391439

1440-
if (!pskb_may_pull(skb, skb->len))
1441-
goto out;
1442-
14431440
iphdr = ipv6_hdr(skb);
14441441
saddr = &iphdr->saddr;
14451442
daddr = &iphdr->daddr;
@@ -1880,7 +1877,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
18801877
return arp_reduce(dev, skb);
18811878
#if IS_ENABLED(CONFIG_IPV6)
18821879
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)) &&
18841882
ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {
18851883
struct nd_msg *msg;
18861884

0 commit comments

Comments
 (0)