summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAndrey Ulanov <andreyu@google.com>2016-04-15 14:24:41 -0700
committerSasha Levin <sasha.levin@oracle.com>2016-07-12 08:47:18 -0400
commit81c379f551f6e871f9de997b026a7cf432cb34ee (patch)
treec7d95521083db9729438603b0fe84bfa73d0eab5 /fs
parent35bec11905351b40951cace13e568e69a6678475 (diff)
downloadlinux-rt-81c379f551f6e871f9de997b026a7cf432cb34ee.tar.gz
namespace: update event counter when umounting a deleted dentry
[ Upstream commit e06b933e6ded42384164d28a2060b7f89243b895 ] - m_start() in fs/namespace.c expects that ns->event is incremented each time a mount added or removed from ns->list. - umount_tree() removes items from the list but does not increment event counter, expecting that it's done before the function is called. - There are some codepaths that call umount_tree() without updating "event" counter. e.g. from __detach_mounts(). - When this happens m_start may reuse a cached mount structure that no longer belongs to ns->list (i.e. use after free which usually leads to infinite loop). This change fixes the above problem by incrementing global event counter before invoking umount_tree(). Change-Id: I622c8e84dcb9fb63542372c5dbf0178ee86bb589 Cc: stable@vger.kernel.org Signed-off-by: Andrey Ulanov <andreyu@google.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index db31a49e01fd..d0cd3f4012ec 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1494,6 +1494,7 @@ void __detach_mounts(struct dentry *dentry)
goto out_unlock;
lock_mount_hash();
+ event++;
while (!hlist_empty(&mp->m_list)) {
mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
umount_tree(mnt, 0);