lkml.org 
[lkml]   [2006]   [Oct]   [9]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 9 Oct 2006 00:40:14 -0700
FromAndrew Morton <>
SubjectRe: [patch 1/2] sysfs: allow removal of nonexistent sysfs groups.
On Mon, 9 Oct 2006 09:29:20 +0200
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> This patch makes it safe to call sysfs_remove_group() with a name group
> that doesn't exist. Needed to make fix cpu hotplug stuff in topology code.
> 

Surely an attempt to remove a non-existent entry is a bug, and this
(racy-looking) patch just covers that up?

> ---
>  fs/sysfs/group.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/fs/sysfs/group.c
> ===================================================================
> --- linux-2.6.orig/fs/sysfs/group.c	2006-10-09 09:15:25.000000000 +0200
> +++ linux-2.6/fs/sysfs/group.c	2006-10-09 09:25:23.000000000 +0200
> @@ -68,9 +68,12 @@
>  {
>  	struct dentry * dir;
> 
> -	if (grp->name)
> +	if (grp->name) {
> +		if (!sysfs_dirent_exist(kobj->dentry->d_fsdata, grp->name))
> +			return;
>  		dir = lookup_one_len(grp->name, kobj->dentry,
>  				strlen(grp->name));
> +	}
>  	else
>  		dir = dget(kobj->dentry);
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-09 09:43    [from the cache]
©2003-2008