ieee802154: 6lowpan: fix non-lowpan wpan interfaces
authorAlexander Aring <alex.aring@gmail.com>
Sat, 15 Aug 2015 09:00:33 +0000 (11:00 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 15 Aug 2015 21:28:09 +0000 (23:28 +0200)
We receive all 802.15.4 frames on the packet handler "lowpan_rcv" this
patch checks if the wpan device belongs to a lowpan interface.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/ieee802154/6lowpan/rx.c

index d6f5e8ee6fdaf0ac62b48fd69eede2ca4aaf318f..12e10201d263860d64cc7835bd947459e4d95873 100644 (file)
@@ -67,6 +67,10 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
        struct ieee802154_hdr hdr;
        int ret;
 
+       if (dev->type != ARPHRD_IEEE802154 ||
+           !dev->ieee802154_ptr->lowpan_dev)
+               goto drop;
+
        skb = skb_share_check(skb, GFP_ATOMIC);
        if (!skb)
                goto drop;
@@ -77,9 +81,6 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop_skb;
 
-       if (dev->type != ARPHRD_IEEE802154)
-               goto drop_skb;
-
        if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
                goto drop_skb;