sysfs: fail dentry revalidation after namespace change fix
authorAndrew Morton <akpm@linux-foundation.org>
Mon, 9 Jul 2012 23:13:36 +0000 (16:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jul 2012 16:43:55 +0000 (09:43 -0700)
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>
fs/sysfs/dir.c

index c0bf38a21caae119deac73128ae7b2ac4db19ce3..1cdfb53199aa4057fc824f29d9fd64fb6ee7fcbb 100644 (file)
@@ -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:
This page took 0.029069 seconds and 5 git commands to generate.