From: Pavel Emelyanov Date: Mon, 5 May 2008 00:57:29 +0000 (-0700) Subject: bridge: Net device leak in br_add_bridge(). X-Git-Tag: v2.6.26-rc2~60^2~13 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c37aa90b0458d87342e0bb083f6bf7d113220d09;p=linux-2.6 bridge: Net device leak in br_add_bridge(). 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 Signed-off-by: David S. Miller --- diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 77a981a1ee..bff0f5bb12 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -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)