* [PATCH] vxlan: using pskb_may_pull as early as possible
@ 2014-10-16 1:17 roy.qing.li
2014-10-16 3:33 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2014-10-16 1:17 UTC (permalink / raw)
To: netdev; +Cc: xiyou.wangcong
From: Li RongQing <roy.qing.li@gmail.com>
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>
---
drivers/net/vxlan.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index faf1bd1..77ab844 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -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;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vxlan: using pskb_may_pull as early as possible
2014-10-16 1:17 [PATCH] vxlan: using pskb_may_pull as early as possible roy.qing.li
@ 2014-10-16 3:33 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-10-16 3:33 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev, xiyou.wangcong
From: roy.qing.li@gmail.com
Date: Thu, 16 Oct 2014 09:17:18 +0800
> From: Li RongQing <roy.qing.li@gmail.com>
>
> 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>
Also applied and queued up for -stable,thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-16 3:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16 1:17 [PATCH] vxlan: using pskb_may_pull as early as possible roy.qing.li
2014-10-16 3:33 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).