Skip to contentSkip to conversation

: Net device leak in br_add_bridge().

PATCH Applied Pavel Emelyanov 2 participants 2 messages May 4, 2008 – May 5, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 : 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.

---
 net/bridge/br_if.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
net/bridge/br_if.c +3 -1
index 77a981a..bff0f5b 100644
@@ -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)