aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 043a5eb8cafc..13f34acb2a8e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -229,6 +229,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
229int br_add_bridge(struct net *net, const char *name) 229int br_add_bridge(struct net *net, const char *name)
230{ 230{
231 struct net_device *dev; 231 struct net_device *dev;
232 int res;
232 233
233 dev = alloc_netdev(sizeof(struct net_bridge), name, 234 dev = alloc_netdev(sizeof(struct net_bridge), name,
234 br_dev_setup); 235 br_dev_setup);
@@ -238,7 +239,10 @@ int br_add_bridge(struct net *net, const char *name)
238 239
239 dev_net_set(dev, net); 240 dev_net_set(dev, net);
240 241
241 return register_netdev(dev); 242 res = register_netdev(dev);
243 if (res)
244 free_netdev(dev);
245 return res;
242} 246}
243 247
244int br_del_bridge(struct net *net, const char *name) 248int br_del_bridge(struct net *net, const char *name)