mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-13 01:08:50 +00:00
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>
This commit is contained in:
parent
e5bcac6147
commit
17f79be93d
@ -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 */
|
/* The sysfs dirent has been moved to a different namespace */
|
||||||
type = KOBJ_NS_TYPE_NONE;
|
type = KOBJ_NS_TYPE_NONE;
|
||||||
if (sd->s_parent)
|
if (sd->s_parent) {
|
||||||
type = sysfs_ns_type(sd->s_parent);
|
type = sysfs_ns_type(sd->s_parent);
|
||||||
if (type && (sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns))
|
if (type != KOBJ_NS_TYPE_NONE &&
|
||||||
goto out_bad;
|
sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns)
|
||||||
|
goto out_bad;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&sysfs_mutex);
|
mutex_unlock(&sysfs_mutex);
|
||||||
out_valid:
|
out_valid:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user