]> www.infradead.org Git - users/jedix/linux-maple.git/commit
namespace: update event counter when umounting a deleted dentry
authorAndrey Ulanov <andreyu@google.com>
Fri, 15 Apr 2016 21:24:41 +0000 (14:24 -0700)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:21:58 +0000 (17:21 -0500)
commitd0ea0d5e9ebf8450f4222b536c19c1f1be149374
treee1af68ab5519718bf6e2c0daa5b316d8af24336d
parent6cdc1953f286bffedd837ba3d96dcef2175dd105
namespace: update event counter when umounting a deleted dentry

Orabug: 25308035

[ 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>
(cherry picked from commit 2119a62b133e4b4ade51cbc446f31b728662eed8)
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/namespace.c