netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH 1/2][BRIDGE]: Net device leak in br_add_bridge().
Date: Sun, 04 May 2008 10:47:29 +0400	[thread overview]
Message-ID: <481D5C01.30906@openvz.org> (raw)

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)

             reply	other threads:[~2008-05-04  6:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-04  6:47 Pavel Emelyanov [this message]
2008-05-05  0:57 ` [PATCH 1/2][BRIDGE]: Net device leak in br_add_bridge() David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=481D5C01.30906@openvz.org \
    --to=xemul@openvz.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).