summaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorAndrey Ulanov <andreyu@google.com>2016-04-15 14:24:41 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-10 11:49:27 +0200
commitdf582d46960cc3151bc2dc564af9128b4c7f9b4b (patch)
treeb488dbe4c79de505d41fc7116610295b41030381 /fs/namespace.c
parent7d9f345ca6810010456e99c7cdea112b500b9547 (diff)
downloadlinux-stable-df582d46960cc3151bc2dc564af9128b4c7f9b4b.tar.gz
linux-stable-df582d46960cc3151bc2dc564af9128b4c7f9b4b.tar.bz2
linux-stable-df582d46960cc3151bc2dc564af9128b4c7f9b4b.zip
namespace: update event counter when umounting a deleted dentry
commit e06b933e6ded42384164d28a2060b7f89243b895 upstream. - 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 Signed-off-by: Andrey Ulanov <andreyu@google.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 33064fcbfff9..5be02a0635be 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1562,6 +1562,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);
if (mnt->mnt.mnt_flags & MNT_UMOUNT) {