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: <1279836546-26913-5-git-send-email-ppannuto@codeaurora.org>
Date:	Thu, 22 Jul 2010 15:09:04 -0700
From:	Patrick Pannuto <ppannuto@...eaurora.org>
To:	linux-kernel@...r.kernel.org
Cc:	ppannuto@...eaurora.org, Greg Kroah-Hartman <gregkh@...e.de>,
	Andi Kleen <ak@...ux.intel.com>,
	Stephen Hemminger <shemminger@...tta.com>,
	Jens Axboe <jens.axboe@...cle.com>,
	David Teigland <teigland@...hat.com>
Subject: [PATCH 4/6] Driver core: Fix memory leak on sysdev_class_register error path

This leak is the same as the bus path; cls->kset.kobj.name is
set, but kset_register fails, thus nothing will ever call
kset_unregister and name will be leaked

Signed-off-by: Patrick Pannuto <ppannuto@...eaurora.org>
---
 drivers/base/sys.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 9354dc1..e5deab1 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -22,6 +22,7 @@
 #include <linux/device.h>
 #include <linux/mutex.h>
 #include <linux/interrupt.h>
+#include <linux/slab.h>
 
 #include "base.h"
 
@@ -148,6 +149,8 @@ int sysdev_class_register(struct sysdev_class *cls)
 	if (!retval && cls->attrs)
 		retval = sysfs_create_files(&cls->kset.kobj,
 					    (const struct attribute **)cls->attrs);
+	else
+		kfree(cls->kset.kobj.name);
 	return retval;
 }
 
-- 
1.7.2

--
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