diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 0363f1bdc401db109d81b54195f6d93ddb24416b..ed2b6002ae53722ec16f241c89e454cb8fbb86f8 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -603,13 +603,15 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, call_netdevice_notifiers(NETDEV_JOIN, dev); err = dev_set_allmulti(dev, 1); - if (err) - goto put_back; + if (err) { + kfree(p); /* kobject not yet init'd, manually free */ + goto err1; + } err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), SYSFS_BRIDGE_PORT_ATTR); if (err) - goto err1; + goto err2; err = br_sysfs_addif(p); if (err) @@ -692,12 +694,9 @@ int br_add_if(struct net_bridge *br, struct net_device *dev, sysfs_remove_link(br->ifobj, p->dev->name); err2: kobject_put(&p->kobj); - p = NULL; /* kobject_put frees */ -err1: dev_set_allmulti(dev, -1); -put_back: +err1: dev_put(dev); - kfree(p); return err; }