[PATCH 2/3] bridge: Use correct cleanup function

Tobin C. Harding
2019-04-30T00:29:18Z

The correct cleanup function if a call to kobject_init_and_add() has
returned _successfully_ is kobject_del(). kobject_put() is used if the
call to kobject_init_and_add() fails. kobject_del() calls kobject_put().

Use correct cleanup function in error path.

Signed-off-by: Tobin C. Harding <tobin@kernel.org>
---
net/bridge/br_if.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index e5c8c9941c51..d3a1554ccff4 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -701,7 +701,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
err3:
sysfs_remove_link(br->ifobj, p->dev->name);
err2:
- kobject_put(&p->kobj);
+ kobject_del(&p->kobj);
p = NULL; /* kobject_put frees */
err1:
dev_set_allmulti(dev, -1);
--
2.21.0