From: Jiri Benc <jbenc@suse.cz>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: David Miller <davem@davemloft.net>, NetDev <netdev@vger.kernel.org>
Subject: [PATCH] bridge: fix locking and memory leak in br_add_bridge
Date: Thu, 25 May 2006 15:31:24 +0200 [thread overview]
Message-ID: <20060525153124.478bea57@griffin.suse.cz> (raw)
There are several problems in error handling in br_add_bridge:
- when dev_alloc_name fails, allocated net_device is not freed
- unregister_netdev is called when rtnl lock is held
- free_netdev is called before netdev_run_todo has a chance to be run after
unregistering net_device
This patch should fix these issues.
Signed-off-by: Jiri Benc <jbenc@suse.cz>
---
net/bridge/br_if.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
--- dscape.orig/net/bridge/br_if.c
+++ dscape/net/bridge/br_if.c
@@ -306,20 +306,19 @@ int br_add_bridge(const char *name)
ret = register_netdevice(dev);
if (ret)
- goto err2;
+ goto err1;
ret = br_sysfs_addbr(dev);
if (ret)
- goto err3;
+ goto err2;
rtnl_unlock();
return 0;
- err3:
- unregister_netdev(dev);
err2:
- free_netdev(dev);
+ unregister_netdevice(dev);
err1:
rtnl_unlock();
+ free_netdev(dev);
return ret;
}
--
Jiri Benc
SUSE Labs
next reply other threads:[~2006-05-25 13:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-25 13:31 Jiri Benc [this message]
2006-05-25 14:07 ` [PATCH] bridge: fix locking and memory leak in br_add_bridge Jiri Benc
2006-05-25 14:14 ` [PATCH v2] " Jiri Benc
2006-05-25 16:23 ` Stephen Hemminger
2006-05-26 9:08 ` Jiri Benc
2006-05-27 2:26 ` David Miller
2006-05-27 8:58 ` Jiri Benc
2006-05-27 16:45 ` [PATCH v3] " Stephen Hemminger
2006-06-05 23:38 ` 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=20060525153124.478bea57@griffin.suse.cz \
--to=jbenc@suse.cz \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.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).