netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2][BRIDGE]: Net device leak in br_add_bridge().
@ 2008-05-04  6:47 Pavel Emelyanov
  2008-05-05  0:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2008-05-04  6:47 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List

In case the register_netdevice() call fails the device is leaked,
since the out: label is just rtnl_unlock()+return.

Free the device.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---
 net/bridge/br_if.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 77a981a..bff0f5b 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -280,8 +280,10 @@ int br_add_bridge(const char *name)
 	}
 
 	ret = register_netdevice(dev);
-	if (ret)
+	if (ret) {
+		free_netdev(dev);
 		goto out;
+	}
 
 	ret = br_sysfs_addbr(dev);
 	if (ret)

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

* Re: [PATCH 1/2][BRIDGE]: Net device leak in br_add_bridge().
  2008-05-04  6:47 [PATCH 1/2][BRIDGE]: Net device leak in br_add_bridge() Pavel Emelyanov
@ 2008-05-05  0:57 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-05-05  0:57 UTC (permalink / raw)
  To: xemul; +Cc: netdev

From: Pavel Emelyanov <xemul@openvz.org>
Date: Sun, 04 May 2008 10:47:29 +0400

> In case the register_netdevice() call fails the device is leaked,
> since the out: label is just rtnl_unlock()+return.
> 
> Free the device.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied.

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

end of thread, other threads:[~2008-05-05  0:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04  6:47 [PATCH 1/2][BRIDGE]: Net device leak in br_add_bridge() Pavel Emelyanov
2008-05-05  0:57 ` 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).