aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-04-19 22:03:08 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-04-19 23:52:15 -0400
commit16a34adb9392b2fe4195267475ab5b472e55292c (patch)
tree5766d9f28563c58dde9077501d23d7319dfcdd98 /fs
parent8e04944f0ea8b838399049bdcda920ab36ae3b04 (diff)
Don't leak MNT_INTERNAL away from internal mounts
We want it only for the stuff created by SB_KERNMOUNT mounts, *not* for their copies. As it is, creating a deep stack of bindings of /proc/*/ns/* somewhere in a new namespace and exiting yields a stack overflow. Cc: stable@kernel.org Reported-by: Alexander Aring <aring@mojatatu.com> Bisected-by: Kirill Tkhai <ktkhai@virtuozzo.com> Tested-by: Kirill Tkhai <ktkhai@virtuozzo.com> Tested-by: Alexander Aring <aring@mojatatu.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index e398f32d7541..8634d565b858 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1089,7 +1089,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
1089 goto out_free; 1089 goto out_free;
1090 } 1090 }
1091 1091
1092 mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~(MNT_WRITE_HOLD|MNT_MARKED); 1092 mnt->mnt.mnt_flags = old->mnt.mnt_flags;
1093 mnt->mnt.mnt_flags &= ~(MNT_WRITE_HOLD|MNT_MARKED|MNT_INTERNAL);
1093 /* Don't allow unprivileged users to change mount flags */ 1094 /* Don't allow unprivileged users to change mount flags */
1094 if (flag & CL_UNPRIVILEGED) { 1095 if (flag & CL_UNPRIVILEGED) {
1095 mnt->mnt.mnt_flags |= MNT_LOCK_ATIME; 1096 mnt->mnt.mnt_flags |= MNT_LOCK_ATIME;