]> git.baikalelectronics.ru Git - kernel.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)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Jul 2016 03:28:30 +0000 (23:28 -0400)
commit0e0e71706f33cd3aa6e9c17848f0e8530a2b8ba7
tree5dfb0149aec8be222d613391fd1e49c791d6485f
parente995cf58888a27cca567f310ab0c5ec7ce8ddd48
namespace: update event counter when umounting a deleted dentry

- 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>
fs/namespace.c