diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/debugfs/inode.c | 4 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index d17c20fd74e6..4733eab34a23 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -495,7 +495,7 @@ void debugfs_remove(struct dentry *dentry) | |||
495 | struct dentry *parent; | 495 | struct dentry *parent; |
496 | int ret; | 496 | int ret; |
497 | 497 | ||
498 | if (!dentry) | 498 | if (IS_ERR_OR_NULL(dentry)) |
499 | return; | 499 | return; |
500 | 500 | ||
501 | parent = dentry->d_parent; | 501 | parent = dentry->d_parent; |
@@ -527,7 +527,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
527 | struct dentry *child; | 527 | struct dentry *child; |
528 | struct dentry *parent; | 528 | struct dentry *parent; |
529 | 529 | ||
530 | if (!dentry) | 530 | if (IS_ERR_OR_NULL(dentry)) |
531 | return; | 531 | return; |
532 | 532 | ||
533 | parent = dentry->d_parent; | 533 | parent = dentry->d_parent; |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index a5cf784f9cc2..6b0bb00d4d2b 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -307,6 +307,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags) | |||
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 (flags & LOOKUP_RCU) | 312 | if (flags & LOOKUP_RCU) |
312 | return -ECHILD; | 313 | return -ECHILD; |
@@ -326,6 +327,15 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags) | |||
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 != KOBJ_NS_TYPE_NONE && | ||
335 | sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns) | ||
336 | goto out_bad; | ||
337 | } | ||
338 | |||
329 | mutex_unlock(&sysfs_mutex); | 339 | mutex_unlock(&sysfs_mutex); |
330 | out_valid: | 340 | out_valid: |
331 | return 1; | 341 | return 1; |