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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 22 Jul 2010 16:43:41 -0700
From:	Greg KH <greg@...ah.com>
To:	Patrick Pannuto <ppannuto@...eaurora.org>
Cc:	linux-kernel@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Emese Revfy <re.emese@...il.com>,
	Stephen Hemminger <shemminger@...tta.com>,
	Jens Axboe <jens.axboe@...cle.com>
Subject: Re: [PATCH 6/6] kobj: Fix memory leak on error path of
 kset_create_and_add

On Thu, Jul 22, 2010 at 03:09:06PM -0700, Patrick Pannuto wrote:
> This leak is the same as the bus path; 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>
> ---
>  lib/kobject.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/kobject.c b/lib/kobject.c
> index f07c572..713b235 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -843,6 +843,7 @@ struct kset *kset_create_and_add(const char *name,
>  		return NULL;
>  	error = kset_register(kset);
>  	if (error) {
> +		kfree(kset->kobj.name);

Again, we should be able to clean this up automatically better than
forcing this code to "know" that it has to handle this.

Any other ideas?

And are these error paths something that you have seen in a working
system?

thanks,

greg k-h
--
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