6lowpan: release device on error path
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 7 Nov 2013 07:44:45 +0000 (10:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Nov 2013 00:11:13 +0000 (19:11 -0500)
We recently added a new error path and it needs a dev_put().

Fixes: 7adac1ec8198 ('6lowpan: Only make 6lowpan links to IEEE802154 devices')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ieee802154/6lowpan.c

index 9497c6f3276be23fa88958304d0559d235d346bb..426b5df1c98f1cc195158c9829a536cfbd0fefd6 100644 (file)
@@ -1358,8 +1358,10 @@ 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)
+       if (real_dev->type != ARPHRD_IEEE802154) {
+               dev_put(real_dev);
                return -EINVAL;
+       }
 
        lowpan_dev_info(dev)->real_dev = real_dev;
        lowpan_dev_info(dev)->fragment_tag = 0;