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: <a8e1da0905102316v1037c89cs48cb052924c250a9@mail.gmail.com>
Date:	Mon, 11 May 2009 14:16:36 +0800
From:	Dave Young <hidave.darkstar@...il.com>
To:	Greg KH <gregkh@...e.de>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/3] kobject : kobject_set_name_vargs leak fix

kobject_set_name_vargs will leak the old_name when return -ENOMEM,
move the kfree(old_name) before the return path.

Signed-off-by: Dave Young <hidave.darkstar@...il.com>
---
lib/kobject.c |    2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff -uprN linux.old/lib/kobject.c linux.new/lib/kobject.c
--- linux.old/lib/kobject.c	2009-05-11 13:59:01.000000000 +0800
+++ linux.new/lib/kobject.c	2009-05-11 13:59:34.000000000 +0800
@@ -221,6 +221,7 @@ int kobject_set_name_vargs(struct kobjec
 	if (kobj->name && !fmt)
 		return 0;

+	kfree(old_name);
 	kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
 	if (!kobj->name)
 		return -ENOMEM;
@@ -229,7 +230,6 @@ int kobject_set_name_vargs(struct kobjec
 	while ((s = strchr(kobj->name, '/')))
 		s[0] = '!';

-	kfree(old_name);
 	return 0;
 }
--
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