Skip to content

Commit

Permalink
6LoWPAN: call dev_put() on error in lowpan_newlink()
Browse files Browse the repository at this point in the history
We should release the dev_hold() on error before returning here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Sep 15, 2011
1 parent aec9db3 commit dc00fd4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/ieee802154/6lowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,11 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev,
mutex_init(&lowpan_dev_info(dev)->dev_list_mtx);

entry = kzalloc(sizeof(struct lowpan_dev_record), GFP_KERNEL);
if (!entry)
if (!entry) {
dev_put(real_dev);
lowpan_dev_info(dev)->real_dev = NULL;
return -ENOMEM;
}

entry->ldev = dev;

Expand Down

0 comments on commit dc00fd4

Please sign in to comment.