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:  <5dfxq21jg4.fsf@Hurtta06k.keh.iki.fi>
Date:	22 Jul 2008 10:12:11 +0300
From:	Kari Hurtta <hurtta+gmane@...lo.fmi.fi>
To:	linux-kernel@...r.kernel.org
Subject:  Re: [PATCH 02/79] kobject: replace '/' with '!' in name

Greg Kroah-Hartman <gregkh@...e.de> writes in gmane.linux.kernel:

> From: Kay Sievers <kay.sievers@...y.org>
> 
> Some (block) devices have a '/' in the name, and need special
> handling. Let's have that rule to the core, so we can remove it
> from the block class.
> 
> Signed-off-by: Kay Sievers <kay.sievers@...y.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
> ---
>  lib/kobject.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/kobject.c b/lib/kobject.c
> index dcade05..7444015 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -216,13 +216,19 @@ static int kobject_add_internal(struct kobject *kobj)
>  static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
>  				  va_list vargs)
>  {
> -	/* Free the old name, if necessary. */
> -	kfree(kobj->name);
> +	const char *old_name = kobj->name;
> +	char *s;
>  
>  	kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
>  	if (!kobj->name)
>  		return -ENOMEM;

Is this leaking old_name if kvasprintf returns NULL ?

kobj->name is that point to set NULL  and old value
of kobj->name (old_name) is not free'ed
  
> +	/* ewww... some of these buggers have '/' in the name ... */
> +	s = strchr(kobj->name, '/');
> +	if (s)
> +		s[0] = '!';
> +
> +	kfree(old_name);
>  	return 0;
>  }
>  
> -- 
> 1.5.6.3

/ Kari Hurtta

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