git.samba.org
/
sfrench
/
cifs-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mnt: Prevent pivot_root from creating a loop in the mount tree
[sfrench/cifs-2.6.git]
/
fs
/
namespace.c
diff --git
a/fs/namespace.c
b/fs/namespace.c
index ef42d9bee2121f8e6a68937a5ecaa7670721ded9..74647c2fe69ca3703c2c1492555f5c85eb73ce72 100644
(file)
--- a/
fs/namespace.c
+++ b/
fs/namespace.c
@@
-2820,6
+2820,9
@@
SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
/* make sure we can reach put_old from new_root */
if (!is_path_reachable(old_mnt, old.dentry, &new))
goto out4;
/* make sure we can reach put_old from new_root */
if (!is_path_reachable(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;
root_mp->m_count++; /* pin it so it won't go away */
lock_mount_hash();
detach_mnt(new_mnt, &parent_path);
root_mp->m_count++; /* pin it so it won't go away */
lock_mount_hash();
detach_mnt(new_mnt, &parent_path);