[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190430002817.10785-3-tobin@kernel.org>
Date: Tue, 30 Apr 2019 10:28:16 +1000
From: "Tobin C. Harding" <tobin@...nel.org>
To: "David S. Miller" <davem@...emloft.net>
Cc: "Tobin C. Harding" <tobin@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tyler Hicks <tyhicks@...onical.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ido Schimmel <idosch@...lanox.com>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Florian Fainelli <f.fainelli@...il.com>,
Wang Hai <wanghai26@...wei.com>,
YueHaibing <yuehaibing@...wei.com>,
Amritha Nambiar <amritha.nambiar@...el.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] bridge: Use correct cleanup function
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@...nel.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
Powered by blists - more mailing lists