netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/3 -next] 6LoWPAN: call dev_put() on error in lowpan_newlink()
@ 2011-08-30 13:51 Dan Carpenter
       [not found] ` <20110830135109.GJ3705-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-08-30 13:51 UTC (permalink / raw)
  To: Alexander Smirnov
  Cc: Dmitry Eremin-Solenikov, Sergey Lapin, David S. Miller,
	open list:IEEE 802.15.4 SUB..., open list:NETWORKING [GENERAL],
	kernel-janitors

We should release the dev_hold() on error before returning here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
All three of these patches were compile tested only, but this is the
one I'm not very certain of.  I've obviously tried to get it right,
but please review it carefully.

diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index 5dc0489..f0d1536 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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 3/3 -next] 6LoWPAN: call dev_put() on error in lowpan_newlink()
       [not found] ` <20110830135109.GJ3705-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
@ 2011-09-15 19:42   ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-09-15 19:42 UTC (permalink / raw)
  To: error27-Re5JQEeQqe8AvxtiuMwx3w
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

From: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Tue, 30 Aug 2011 16:51:09 +0300

> We should release the dev_hold() on error before returning here.
> 
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Applied.

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-15 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-30 13:51 [patch 3/3 -next] 6LoWPAN: call dev_put() on error in lowpan_newlink() Dan Carpenter
     [not found] ` <20110830135109.GJ3705-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
2011-09-15 19:42   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).