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]
Date:	Wed, 25 Aug 2010 01:42:31 -0700
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Dan Carpenter <error27@...il.com>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	Serge Hallyn <serue@...ibm.com>,
	Stephen Hemminger <shemminger@...tta.com>,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [patch] sysfs: checking for NULL instead of ERR_PTR

Dan Carpenter <error27@...il.com> writes:

> d_path() returns an ERR_PTR and it doesn't return NULL.
>
> CC:stable@...nel.org
> Signed-off-by: Dan Carpenter <error27@...il.com>

This is definitely a needed bug fix.

Reviewed-by: "Eric W. Biederman" <ebiederm@...ssion.com>

If we ever get ERR_PTR(-ENAMETOOLONG) and this case actually matters 
something is very wrong with sysfs, but that is another story.

Eric


> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 1b27b56..da3fefe 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -340,7 +340,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
>  	char *p;
>  
>  	p = d_path(&file->f_path, last_sysfs_file, sizeof(last_sysfs_file));
> -	if (p)
> +	if (!IS_ERR(p))
>  		memmove(last_sysfs_file, p, strlen(p) + 1);
>  
>  	/* need attr_sd for attr and ops, its parent for kobj */
--
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