diff --git a/fs/namespace.c b/fs/namespace.c index f0f2e067c5d..f7be8d9c1cd 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2508,6 +2508,9 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, /* make sure we can reach put_old from new_root */ if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new)) goto out4; + /* make certain new is below the root */ + if (!is_path_reachable(new_mnt, new.dentry, &root)) + goto out4; br_write_lock(vfsmount_lock); detach_mnt(new_mnt, &parent_path); detach_mnt(root_mnt, &root_parent);