aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/sysfs/dir.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index c0bf38a21caa..1cdfb53199aa 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)
329 329
330 /* The sysfs dirent has been moved to a different namespace */ 330 /* The sysfs dirent has been moved to a different namespace */
331 type = KOBJ_NS_TYPE_NONE; 331 type = KOBJ_NS_TYPE_NONE;
332 if (sd->s_parent) 332 if (sd->s_parent) {
333 type = sysfs_ns_type(sd->s_parent); 333 type = sysfs_ns_type(sd->s_parent);
334 if (type && (sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns)) 334 if (type != KOBJ_NS_TYPE_NONE &&
335 goto out_bad; 335 sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns)
336 goto out_bad;
337 }
336 338
337 mutex_unlock(&sysfs_mutex); 339 mutex_unlock(&sysfs_mutex);
338out_valid: 340out_valid: