public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jeff Garzik <jeff@garzik.org>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Greg KH <greg@kroah.com>, Ashok Raj <ashok.raj@intel.com>,
	Nathan Lynch <nathanl@austin.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 1/2] sysfs: allow removal of nonexistent sysfs groups.
Date: Mon, 9 Oct 2006 00:40:14 -0700	[thread overview]
Message-ID: <20061009004014.11ed8df2.akpm@osdl.org> (raw)
In-Reply-To: <20061009072920.GB6936@osiris.boeblingen.de.ibm.com>

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

  reply	other threads:[~2006-10-09  7:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-04 13:05 [PATCH] drivers/base: error handling fixes Jeff Garzik
2006-10-04 14:44 ` Cornelia Huck
2006-10-04 15:24 ` Cornelia Huck
2006-10-05  8:17   ` Heiko Carstens
2006-10-05 11:16     ` Jeff Garzik
2006-10-05 12:48       ` Heiko Carstens
2006-10-05 12:58         ` Jeff Garzik
2006-10-05 13:16           ` Heiko Carstens
2006-10-09  7:29             ` [patch 1/2] sysfs: allow removal of nonexistent sysfs groups Heiko Carstens
2006-10-09  7:40               ` Andrew Morton [this message]
2006-10-09  7:49                 ` Heiko Carstens
2006-10-09  7:30             ` [patch 2/2] cpu topology: various fixes/cleanups Heiko Carstens
2006-10-05 13:15         ` [PATCH] drivers/base: error handling fixes Cornelia Huck
2006-10-05 13:20           ` Heiko Carstens
2006-10-05 13:45             ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061009004014.11ed8df2.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=ashok.raj@intel.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=greg@kroah.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathanl@austin.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox