aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/sysfs/dir.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index e6bb9b2a4cbe..c0bf38a21caa 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -307,6 +307,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
307{ 307{
308 struct sysfs_dirent *sd; 308 struct sysfs_dirent *sd;
309 int is_dir; 309 int is_dir;
310 int type;
310 311
311 if (nd->flags & LOOKUP_RCU) 312 if (nd->flags & LOOKUP_RCU)
312 return -ECHILD; 313 return -ECHILD;
@@ -326,6 +327,13 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
326 if (strcmp(dentry->d_name.name, sd->s_name) != 0) 327 if (strcmp(dentry->d_name.name, sd->s_name) != 0)
327 goto out_bad; 328 goto out_bad;
328 329
330 /* The sysfs dirent has been moved to a different namespace */
331 type = KOBJ_NS_TYPE_NONE;
332 if (sd->s_parent)
333 type = sysfs_ns_type(sd->s_parent);
334 if (type && (sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns))
335 goto out_bad;
336
329 mutex_unlock(&sysfs_mutex); 337 mutex_unlock(&sysfs_mutex);
330out_valid: 338out_valid:
331 return 1; 339 return 1;