This patch makes the data pointer in lowpan_fetch_skb optionally. We can
use this if we doesn't care about the fetched data.

Signed-off-by: Alexander Aring <alex.ar...@gmail.com>
---
 include/net/6lowpan.h         | 4 +++-
 net/ieee802154/6lowpan_rtnl.c | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index 1e97017..e940abb 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -285,7 +285,9 @@ static inline bool lowpan_fetch_skb(struct sk_buff *skb,
        if (unlikely(!pskb_may_pull(skb, len)))
                return true;
 
-       skb_copy_from_linear_data(skb, data, len);
+       if (data)
+               skb_copy_from_linear_data(skb, data, len);
+
        skb_pull(skb, len);
 
        return false;
diff --git a/net/ieee802154/6lowpan_rtnl.c b/net/ieee802154/6lowpan_rtnl.c
index 2566dad..c35e63e 100644
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -434,6 +434,7 @@ static int lowpan_rcv(struct sk_buff *skb, struct 
net_device *dev,
 {
        struct sk_buff *local_skb;
        int ret;
+       bool fail;
 
        if (!netif_running(dev))
                goto drop_skb;
@@ -453,7 +454,9 @@ static int lowpan_rcv(struct sk_buff *skb, struct 
net_device *dev,
                local_skb->pkt_type = PACKET_HOST;
 
                /* Pull off the 1-byte of 6lowpan header. */
-               skb_pull(local_skb, 1);
+               fail = lowpan_fetch_skb(local_skb, NULL, 1);
+               if (fail)
+                       goto drop;
 
                ret = lowpan_give_skb_to_devices(local_skb, NULL);
                if (ret == NET_RX_DROP)
-- 
1.9.0


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to