aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namespace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 912d273..4f47629 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2618,6 +2618,9 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
goto out4;
} else if (!is_subdir(old.dentry, new.dentry))
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);