From dc00fd44413e9d4310d0dc6bcc3bd8e57ba8f064 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 30 Aug 2011 03:51:09 +0000 Subject: [PATCH] 6LoWPAN: call dev_put() on error in lowpan_newlink() We should release the dev_hold() on error before returning here. Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- net/ieee802154/6lowpan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 5dc04890e0c5..f0d15365722a 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -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; -- 2.30.2