From: ebiederm@xmission.com (Eric W. Biederman)
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Tejun Heo <tj@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()
Date: Wed, 30 Oct 2013 14:42:35 -0700 [thread overview]
Message-ID: <87wqku1lmc.fsf@xmission.com> (raw)
In-Reply-To: <20131029220939.GA23060@kroah.com> (Greg KH's message of "Tue, 29 Oct 2013 15:09:39 -0700")
Greg KH <gregkh@linuxfoundation.org> writes:
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> Linus noticed that the assignment of sd isn't protected by the lock in
> sysfs_remove_dir(), so move the assignment of the variable under the
> lock to be safe.
>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
> ---
>
> Tejun, any objection to this patch? You consolidated the locks back in
> 2007 on this function, and nothing has changed there since then, so odds
> are it's not a problem, but nice to be safe, right?
>
> fs/sysfs/dir.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index eab59de4..2609f934 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -856,9 +856,10 @@ void sysfs_remove(struct sysfs_dirent *sd)
> */
> void sysfs_remove_dir(struct kobject *kobj)
> {
> - struct sysfs_dirent *sd = kobj->sd;
> + struct sysfs_dirent *sd;
>
> spin_lock(&sysfs_assoc_lock);
> + sd = kobj->sd;
> kobj->sd = NULL;
> spin_unlock(&sysfs_assoc_lock);
>
prev parent reply other threads:[~2013-10-30 21:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 22:09 [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir() Greg KH
2013-10-30 0:39 ` Eric W. Biederman
2013-10-30 1:25 ` Linus Torvalds
2013-10-30 5:29 ` Eric W. Biederman
2013-10-30 13:28 ` Tejun Heo
2013-10-30 14:28 ` [PATCH driver-core-next] sysfs: rename sysfs_assoc_lock and explain what it's about Tejun Heo
2013-10-30 22:29 ` Eric W. Biederman
2013-10-31 17:11 ` Tejun Heo
2013-10-30 21:41 ` [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir() Eric W. Biederman
2013-10-30 22:00 ` Tejun Heo
2013-10-30 22:38 ` Greg KH
2013-10-30 13:14 ` Tejun Heo
2013-10-30 21:42 ` Eric W. Biederman [this message]
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=87wqku1lmc.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
/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