Skip to content

Commit

Permalink
bridge: fix a possible net_device leak
Browse files Browse the repository at this point in the history
Jan Beulich reported a possible net_device leak in bridge code after
commit bb900b2 (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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Aug 22, 2011
1 parent 832d80a commit 11f3a6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 11f3a6b

Please sign in to comment.