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-next>] [day] [month] [year] [list]
Message-Id: <1433840721-15918-1-git-send-email-lin.z.chen@intel.com>
Date:	Tue,  9 Jun 2015 17:05:21 +0800
From:	Chen Lin Z <lin.z.chen@...el.com>
To:	gregkh@...uxfoundation.org
Cc:	linux-kernel@...r.kernel.org, bo.he@...el.com,
	yanmin_zhang@...ux.intel.com, Chen Lin Z <lin.z.chen@...el.com>
Subject: [PATCH] driver core: bus: Free the kobject.name if kset_register fails

if register two bus with the same name, kset_register will fail.
it need free kobject.name, otherwise there is a memory leak.

Signed-off-by: Chen Lin Z <lin.z.chen@...el.com>
---
 drivers/base/bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 79bc203..9375048 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -894,8 +894,10 @@ int bus_register(struct bus_type *bus)
 	priv->drivers_autoprobe = 1;
 
 	retval = kset_register(&priv->subsys);
-	if (retval)
+	if (retval) {
+		kfree(priv->subsys.kobj.name);
 		goto out;
+	}
 
 	retval = bus_create_file(bus, &bus_attr_uevent);
 	if (retval)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ