diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2012-07-09 16:13:36 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-17 09:43:55 -0700 |
commit | 17f79be93d95bb0e46bd08681ec9c9e601869c15 (patch) | |
tree | ec9ab980fdd6ef43654668f6d4524f236de1bcc2 /fs/sysfs | |
parent | e5bcac61472ca627241b394d439decd00bba3aea (diff) | |
download | op-kernel-dev-17f79be93d95bb0e46bd08681ec9c9e601869c15.zip op-kernel-dev-17f79be93d95bb0e46bd08681ec9c9e601869c15.tar.gz |
sysfs: fail dentry revalidation after namespace change fix
don't assume that KOBJ_NS_TYPE_NONE==0. Also save a test-n-branch.
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index c0bf38a..1cdfb53 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -329,10 +329,12 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) /* The sysfs dirent has been moved to a different namespace */ type = KOBJ_NS_TYPE_NONE; - if (sd->s_parent) + if (sd->s_parent) { type = sysfs_ns_type(sd->s_parent); - if (type && (sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns)) - goto out_bad; + if (type != KOBJ_NS_TYPE_NONE && + sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns) + goto out_bad; + } mutex_unlock(&sysfs_mutex); out_valid: |