[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1prmc65k0.fsf_-_@frodo.ebiederm.org>
Date: Tue, 07 Oct 2008 03:52:15 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Greg KH <greg@...ah.com>
Cc: Al Viro <viro@...IV.linux.org.uk>,
Benjamin Thery <benjamin.thery@...l.net>,
linux-kernel@...r.kernel.org, "Serge E. Hallyn" <serue@...ibm.com>,
Al Viro <viro@....linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Tejun Heo <tj@...nel.org>
Subject: [PATCH 3/3] sysfs: Take sysfs_mutex when fetching the root inode.
sysfs_get_inode ultimately calls sysfs_count_nlink when the a
directory inode is fectched. sysfs_count_nlink needs to be called
under the sysfs_mutex to guard against the unlikely but possible
scenario that the root directory is changing as we are counting the
number entries in it.
Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
---
fs/sysfs/mount.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 8f2237a..59e55f0 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -65,7 +65,9 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent,
/* get root inode, initialize and unlock it */
error = -ENOMEM;
+ mutex_lock(&sysfs_mutex);
inode = sysfs_get_inode(&sysfs_root);
+ mutex_unlock(&sysfs_mutex);
if (!inode) {
pr_debug("sysfs: could not get root inode\n");
goto out_err;
--
1.5.3.rc6.17.g1911
--
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