]> err.no Git - linux-2.6/commitdiff
bridge: Net device leak in br_add_bridge().
authorPavel Emelyanov <xemul@openvz.org>
Mon, 5 May 2008 00:57:29 +0000 (17:57 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 May 2008 00:57:29 +0000 (17:57 -0700)
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>
net/bridge/br_if.c

index 77a981a1ee52249d5fbed7966f294afe7730ffb3..bff0f5bb12be4598070465b68a5e30fba18c6c6e 100644 (file)
@@ -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)