vxlan: using pskb_may_pull as early as possible
Subsystems (2)
PATCH 1/1 vxlan: using pskb_may_pull as early as possible
From: Li RongQing <[email protected]>
pskb_may_pull should be used to check if skb->data has enough space, skb->len can not ensure that.
Cc Cong Wang <[email protected]>
Signed-off-by Li RongQing <[email protected]>
--- drivers/net/vxlan.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/vxlan.c +2 -4
@@ -1437,9 +1437,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;
@@ -1880,7 +1877,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;
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: [email protected]
Date: Thu, 16 Oct 2014 09:17:18 +0800
Quoted 7 lines
From: Li RongQing <[email protected]>
pskb_may_pullshould be used to check ifskb->datahas enough space,skb->lencan not ensure that.Cc Cong Wang <[email protected]>Signed-off-by Li RongQing <[email protected]>
Also applied and queued up for -stable,thanks.