Skip to content

Commit

Permalink
bridge: Net device leak in br_add_bridge().
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed May 5, 2008
1 parent be0c007 commit c37aa90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c37aa90

Please sign in to comment.