ieee802154: 6lowpan: change if lowpan dev is running
authorAlexander Aring <alex.aring@gmail.com>
Wed, 2 Sep 2015 12:21:21 +0000 (14:21 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 17 Sep 2015 11:20:03 +0000 (13:20 +0200)
We don't need to check if the wpan interface is running because the
lowpan_rcv is the packet layer receive handler for the wpan interface.

Instead doing a check if wpan interface is running we should check if
the lowpan interface is running before starting 6lowpan adaptation layer.

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

index b1442f397cda69b6729c00a5138d63ad9d3a5633..c529d9f2561fbc19c6e95b778d0a751656bb9002 100644 (file)
@@ -65,19 +65,20 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *wdev,
                      struct packet_type *pt, struct net_device *orig_wdev)
 {
        struct ieee802154_hdr hdr;
+       struct net_device *ldev;
        int ret;
 
-       if (wdev->type != ARPHRD_IEEE802154 ||
-           !wdev->ieee802154_ptr->lowpan_dev)
+       if (wdev->type != ARPHRD_IEEE802154)
+               goto drop;
+
+       ldev = wdev->ieee802154_ptr->lowpan_dev;
+       if (!ldev || !netif_running(ldev))
                goto drop;
 
        skb = skb_share_check(skb, GFP_ATOMIC);
        if (!skb)
                goto drop;
 
-       if (!netif_running(wdev))
-               goto drop_skb;
-
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop_skb;