6lowpan: Only make 6lowpan links to IEEE802154 devices
authorAlan Ott <alan@signal11.us>
Sun, 6 Oct 2013 03:15:18 +0000 (23:15 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Oct 2013 19:28:37 +0000 (15:28 -0400)
Refuse to create 6lowpan links if the actual hardware interface is
of any type other than ARPHRD_IEEE802154.

Signed-off-by: Alan Ott <alan@signal11.us>
Suggested-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ieee802154/6lowpan.c

index c85e71e0c7ffc640bd9592ce52b03dbde6cad926..8f56b2b63bfb35bdb9060f0d101221be21580fc0 100644 (file)
@@ -1372,6 +1372,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
        real_dev = dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
        if (!real_dev)
                return -ENODEV;
+       if (real_dev->type != ARPHRD_IEEE802154)
+               return -EINVAL;
 
        lowpan_dev_info(dev)->real_dev = real_dev;
        lowpan_dev_info(dev)->fragment_tag = 0;