lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190430002817.10785-2-tobin@kernel.org>
Date:   Tue, 30 Apr 2019 10:28:15 +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 1/3] bridge: Fix error path for kobject_init_and_add()

Currently error return from kobject_init_and_add() is not followed by a
call to kobject_put().  This means there is a memory leak.

Add call to kobject_put() in error path of kobject_init_and_add().

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

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 41f0a696a65f..e5c8c9941c51 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -607,8 +607,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
 
 	err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
 				   SYSFS_BRIDGE_PORT_ATTR);
-	if (err)
+	if (err) {
+		kobject_put(&p->kobj);
 		goto err1;
+	}
 
 	err = br_sysfs_addif(p);
 	if (err)
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ