aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-08-22 06:05:59 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-03 11:40:50 -0700
commit5ee858c9ab53a4f6b12a095a4982793d4f417f56 (patch)
tree27b8a68433d4029e20ceae2316c953435086c12f /net/bridge/br_if.c
parent8e24aecbcdd00d94474a6e2e61bed59866c0d539 (diff)
downloadkernel_samsung_aries-5ee858c9ab53a4f6b12a095a4982793d4f417f56.zip
kernel_samsung_aries-5ee858c9ab53a4f6b12a095a4982793d4f417f56.tar.gz
kernel_samsung_aries-5ee858c9ab53a4f6b12a095a4982793d4f417f56.tar.bz2
bridge: fix a possible net_device leak
[ Upstream commit 11f3a6bdc2528d1ce2af50202dbf7138fdee1b34 ] Jan Beulich reported a possible net_device leak in bridge code after commit bb900b27a2f4 (bridge: allow creating bridge devices with netlink) Reported-by: Jan Beulich <JBeulich@novell.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1bacca4..6f156c1 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -231,6 +231,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
int br_add_bridge(struct net *net, const char *name)
{
struct net_device *dev;
+ int res;
dev = alloc_netdev(sizeof(struct net_bridge), name,
br_dev_setup);
@@ -240,7 +241,10 @@ int br_add_bridge(struct net *net, const char *name)
dev_net_set(dev, net);
- return register_netdev(dev);
+ res = register_netdev(dev);
+ if (res)
+ free_netdev(dev);
+ return res;
}
int br_del_bridge(struct net *net, const char *name)