1. 01 2月, 2017 1 次提交
    • E
      fs: Better permission checking for submounts · 93faccbb
      Eric W. Biederman 提交于
      To support unprivileged users mounting filesystems two permission
      checks have to be performed: a test to see if the user allowed to
      create a mount in the mount namespace, and a test to see if
      the user is allowed to access the specified filesystem.
      
      The automount case is special in that mounting the original filesystem
      grants permission to mount the sub-filesystems, to any user who
      happens to stumble across the their mountpoint and satisfies the
      ordinary filesystem permission checks.
      
      Attempting to handle the automount case by using override_creds
      almost works.  It preserves the idea that permission to mount
      the original filesystem is permission to mount the sub-filesystem.
      Unfortunately using override_creds messes up the filesystems
      ordinary permission checks.
      
      Solve this by being explicit that a mount is a submount by introducing
      vfs_submount, and using it where appropriate.
      
      vfs_submount uses a new mount internal mount flags MS_SUBMOUNT, to let
      sget and friends know that a mount is a submount so they can take appropriate
      action.
      
      sget and sget_userns are modified to not perform any permission checks
      on submounts.
      
      follow_automount is modified to stop using override_creds as that
      has proven problemantic.
      
      do_mount is modified to always remove the new MS_SUBMOUNT flag so
      that we know userspace will never by able to specify it.
      
      autofs4 is modified to stop using current_real_cred that was put in
      there to handle the previous version of submount permission checking.
      
      cifs is modified to pass the mountpoint all of the way down to vfs_submount.
      
      debugfs is modified to pass the mountpoint all of the way down to
      trace_automount by adding a new parameter.  To make this change easier
      a new typedef debugfs_automount_t is introduced to capture the type of
      the debugfs automount function.
      
      Cc: stable@vger.kernel.org
      Fixes: 069d5ac9 ("autofs:  Fix automounts by using current_real_cred()->uid")
      Fixes: aeaa4a79 ("fs: Call d_automount with the filesystems creds")
      Reviewed-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      Reviewed-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      93faccbb
  2. 10 1月, 2017 1 次提交
    • E
      mnt: Protect the mountpoint hashtable with mount_lock · 3895dbf8
      Eric W. Biederman 提交于
      Protecting the mountpoint hashtable with namespace_sem was sufficient
      until a call to umount_mnt was added to mntput_no_expire.  At which
      point it became possible for multiple calls of put_mountpoint on
      the same hash chain to happen on the same time.
      
      Kristen Johansen <kjlx@templeofstupid.com> reported:
      > This can cause a panic when simultaneous callers of put_mountpoint
      > attempt to free the same mountpoint.  This occurs because some callers
      > hold the mount_hash_lock, while others hold the namespace lock.  Some
      > even hold both.
      >
      > In this submitter's case, the panic manifested itself as a GP fault in
      > put_mountpoint() when it called hlist_del() and attempted to dereference
      > a m_hash.pprev that had been poisioned by another thread.
      
      Al Viro observed that the simple fix is to switch from using the namespace_sem
      to the mount_lock to protect the mountpoint hash table.
      
      I have taken Al's suggested patch moved put_mountpoint in pivot_root
      (instead of taking mount_lock an additional time), and have replaced
      new_mountpoint with get_mountpoint a function that does the hash table
      lookup and addition under the mount_lock.   The introduction of get_mounptoint
      ensures that only the mount_lock is needed to manipulate the mountpoint
      hashtable.
      
      d_set_mounted is modified to only set DCACHE_MOUNTED if it is not
      already set.  This allows get_mountpoint to use the setting of
      DCACHE_MOUNTED to ensure adding a struct mountpoint for a dentry
      happens exactly once.
      
      Cc: stable@vger.kernel.org
      Fixes: ce07d891 ("mnt: Honor MNT_LOCKED when detaching mounts")
      Reported-by: NKrister Johansen <kjlx@templeofstupid.com>
      Suggested-by: NAl Viro <viro@ZenIV.linux.org.uk>
      Acked-by: NAl Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      3895dbf8
  3. 17 12月, 2016 3 次提交
  4. 06 12月, 2016 2 次提交
  5. 04 12月, 2016 1 次提交
  6. 11 10月, 2016 1 次提交
    • E
      latent_entropy: Mark functions with __latent_entropy · 0766f788
      Emese Revfy 提交于
      The __latent_entropy gcc attribute can be used only on functions and
      variables.  If it is on a function then the plugin will instrument it for
      gathering control-flow entropy. If the attribute is on a variable then
      the plugin will initialize it with random contents.  The variable must
      be an integer, an integer array type or a structure with integer fields.
      
      These specific functions have been selected because they are init
      functions (to help gather boot-time entropy), are called at unpredictable
      times, or they have variable loops, each of which provide some level of
      latent entropy.
      Signed-off-by: NEmese Revfy <re.emese@gmail.com>
      [kees: expanded commit message]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      0766f788
  7. 01 10月, 2016 1 次提交
    • E
      mnt: Add a per mount namespace limit on the number of mounts · d2921684
      Eric W. Biederman 提交于
      CAI Qian <caiqian@redhat.com> pointed out that the semantics
      of shared subtrees make it possible to create an exponentially
      increasing number of mounts in a mount namespace.
      
          mkdir /tmp/1 /tmp/2
          mount --make-rshared /
          for i in $(seq 1 20) ; do mount --bind /tmp/1 /tmp/2 ; done
      
      Will create create 2^20 or 1048576 mounts, which is a practical problem
      as some people have managed to hit this by accident.
      
      As such CVE-2016-6213 was assigned.
      
      Ian Kent <raven@themaw.net> described the situation for autofs users
      as follows:
      
      > The number of mounts for direct mount maps is usually not very large because of
      > the way they are implemented, large direct mount maps can have performance
      > problems. There can be anywhere from a few (likely case a few hundred) to less
      > than 10000, plus mounts that have been triggered and not yet expired.
      >
      > Indirect mounts have one autofs mount at the root plus the number of mounts that
      > have been triggered and not yet expired.
      >
      > The number of autofs indirect map entries can range from a few to the common
      > case of several thousand and in rare cases up to between 30000 and 50000. I've
      > not heard of people with maps larger than 50000 entries.
      >
      > The larger the number of map entries the greater the possibility for a large
      > number of active mounts so it's not hard to expect cases of a 1000 or somewhat
      > more active mounts.
      
      So I am setting the default number of mounts allowed per mount
      namespace at 100,000.  This is more than enough for any use case I
      know of, but small enough to quickly stop an exponential increase
      in mounts.  Which should be perfect to catch misconfigurations and
      malfunctioning programs.
      
      For anyone who needs a higher limit this can be changed by writing
      to the new /proc/sys/fs/mount-max sysctl.
      Tested-by: NCAI Qian <caiqian@redhat.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      d2921684
  8. 23 9月, 2016 2 次提交
  9. 16 9月, 2016 1 次提交
    • M
      locks: fix file locking on overlayfs · c568d683
      Miklos Szeredi 提交于
      This patch allows flock, posix locks, ofd locks and leases to work
      correctly on overlayfs.
      
      Instead of using the underlying inode for storing lock context use the
      overlay inode.  This allows locks to be persistent across copy-up.
      
      This is done by introducing locks_inode() helper and using it instead of
      file_inode() to get the inode in locking code.  For non-overlayfs the two
      are equivalent, except for an extra pointer dereference in locks_inode().
      
      Since lock operations are in "struct file_operations" we must also make
      sure not to call underlying filesystem's lock operations.  Introcude a
      super block flag MS_NOREMOTELOCK to this effect.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Acked-by: NJeff Layton <jlayton@poochiereds.net>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      c568d683
  10. 31 8月, 2016 1 次提交
  11. 01 7月, 2016 1 次提交
    • A
      namespace: update event counter when umounting a deleted dentry · e06b933e
      Andrey Ulanov 提交于
      - 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: NAndrey Ulanov <andreyu@google.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e06b933e
  12. 24 6月, 2016 5 次提交
    • A
      fs: Treat foreign mounts as nosuid · 380cf5ba
      Andy Lutomirski 提交于
      If a process gets access to a mount from a different user
      namespace, that process should not be able to take advantage of
      setuid files or selinux entrypoints from that filesystem.  Prevent
      this by treating mounts from other mount namespaces and those not
      owned by current_user_ns() or an ancestor as nosuid.
      
      This will make it safer to allow more complex filesystems to be
      mounted in non-root user namespaces.
      
      This does not remove the need for MNT_LOCK_NOSUID.  The setuid,
      setgid, and file capability bits can no longer be abused if code in
      a user namespace were to clear nosuid on an untrusted filesystem,
      but this patch, by itself, is insufficient to protect the system
      from abuse of files that, when execed, would increase MAC privilege.
      
      As a more concrete explanation, any task that can manipulate a
      vfsmount associated with a given user namespace already has
      capabilities in that namespace and all of its descendents.  If they
      can cause a malicious setuid, setgid, or file-caps executable to
      appear in that mount, then that executable will only allow them to
      elevate privileges in exactly the set of namespaces in which they
      are already privileges.
      
      On the other hand, if they can cause a malicious executable to
      appear with a dangerous MAC label, running it could change the
      caller's security context in a way that should not have been
      possible, even inside the namespace in which the task is confined.
      
      As a hardening measure, this would have made CVE-2014-5207 much
      more difficult to exploit.
      Signed-off-by: NAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: NSeth Forshee <seth.forshee@canonical.com>
      Acked-by: NJames Morris <james.l.morris@oracle.com>
      Acked-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      380cf5ba
    • E
      userns: Remove implicit MNT_NODEV fragility. · 67690f93
      Eric W. Biederman 提交于
      Replace the implict setting of MNT_NODEV on mounts that happen with
      just user namespace permissions with an implicit setting of SB_I_NODEV
      in s_iflags.  The visibility of the implicit MNT_NODEV has caused
      problems in the past.
      
      With this change the fragile case where an implicit MNT_NODEV needs to
      be preserved in do_remount is removed.  Using SB_I_NODEV is much less
      fragile as s_iflags are set during the original mount and never
      changed.
      
      In do_new_mount with the implicit setting of MNT_NODEV gone, the only
      code that can affect mnt_flags is fs_fully_visible so simplify the if
      statement and reduce the indentation of the code to make that clear.
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      67690f93
    • E
      mnt: Simplify mount_too_revealing · a1935c17
      Eric W. Biederman 提交于
      Verify all filesystems that we check in mount_too_revealing set
      SB_I_NOEXEC and SB_I_NODEV in sb->s_iflags.  That is true for today
      and it should remain true in the future.
      
      Remove the now unnecessary checks from mnt_already_visibile that
      ensure MNT_LOCK_NOSUID, MNT_LOCK_NOEXEC, and MNT_LOCK_NODEV are
      preserved.  Making the code shorter and easier to read.
      
      Relying on SB_I_NOEXEC and SB_I_NODEV instead of the user visible
      MNT_NOSUID, MNT_NOEXEC, and MNT_NODEV ensures the many current
      systems where proc and sysfs are mounted with "nosuid, nodev, noexec"
      and several slightly buggy container applications don't bother to
      set those flags continue to work.
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      a1935c17
    • E
      mnt: Move the FS_USERNS_MOUNT check into sget_userns · a001e74c
      Eric W. Biederman 提交于
      Allowing a filesystem to be mounted by other than root in the initial
      user namespace is a filesystem property not a mount namespace property
      and as such should be checked in filesystem specific code.  Move the
      FS_USERNS_MOUNT test into super.c:sget_userns().
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      a001e74c
    • E
      mnt: Refactor fs_fully_visible into mount_too_revealing · 8654df4e
      Eric W. Biederman 提交于
      Replace the call of fs_fully_visible in do_new_mount from before the
      new superblock is allocated with a call of mount_too_revealing after
      the superblock is allocated.   This winds up being a much better location
      for maintainability of the code.
      
      The first change this enables is the replacement of FS_USERNS_VISIBLE
      with SB_I_USERNS_VISIBLE.  Moving the flag from struct filesystem_type
      to sb_iflags on the superblock.
      
      Unfortunately mount_too_revealing fundamentally needs to touch
      mnt_flags adding several MNT_LOCKED_XXX flags at the appropriate
      times.  If the mnt_flags did not need to be touched the code
      could be easily moved into the filesystem specific mount code.
      Acked-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      8654df4e
  13. 15 6月, 2016 1 次提交
    • E
      mnt: Account for MS_RDONLY in fs_fully_visible · 695e9df0
      Eric W. Biederman 提交于
      In rare cases it is possible for s_flags & MS_RDONLY to be set but
      MNT_READONLY to be clear.  This starting combination can cause
      fs_fully_visible to fail to ensure that the new mount is readonly.
      Therefore force MNT_LOCK_READONLY in the new mount if MS_RDONLY
      is set on the source filesystem of the mount.
      
      In general both MS_RDONLY and MNT_READONLY are set at the same for
      mounts so I don't expect any programs to care.  Nor do I expect
      MS_RDONLY to be set on proc or sysfs in the initial user namespace,
      which further decreases the likelyhood of problems.
      
      Which means this change should only affect system configurations by
      paranoid sysadmins who should welcome the additional protection
      as it keeps people from wriggling out of their policies.
      
      Cc: stable@vger.kernel.org
      Fixes: 8c6cf9cc ("mnt: Modify fs_fully_visible to deal with locked ro nodev and atime")
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      695e9df0
  14. 07 6月, 2016 2 次提交
  15. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  16. 04 1月, 2016 1 次提交
  17. 07 12月, 2015 1 次提交
  18. 16 11月, 2015 2 次提交
  19. 24 7月, 2015 1 次提交
    • E
      mnt: In detach_mounts detach the appropriate unmounted mount · fe78fcc8
      Eric W. Biederman 提交于
      The handling of in detach_mounts of unmounted but connected mounts is
      buggy and can lead to an infinite loop.
      
      Correct the handling of unmounted mounts in detach_mount.  When the
      mountpoint of an unmounted but connected mount is connected to a
      dentry, and that dentry is deleted we need to disconnect that mount
      from the parent mount and the deleted dentry.
      
      Nothing changes for the unmounted and connected children.  They can be
      safely ignored.
      
      Cc: stable@vger.kernel.org
      Fixes: ce07d891 mnt: Honor MNT_LOCKED when detaching mounts
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      fe78fcc8
  20. 23 7月, 2015 1 次提交
    • E
      mnt: Clarify and correct the disconnect logic in umount_tree · f2d0a123
      Eric W. Biederman 提交于
      rmdir mntpoint will result in an infinite loop when there is
      a mount locked on the mountpoint in another mount namespace.
      
      This is because the logic to test to see if a mount should
      be disconnected in umount_tree is buggy.
      
      Move the logic to decide if a mount should remain connected to
      it's mountpoint into it's own function disconnect_mount so that
      clarity of expression instead of terseness of expression becomes
      a virtue.
      
      When the conditions where it is invalid to leave a mount connected
      are first ruled out, the logic for deciding if a mount should
      be disconnected becomes much clearer and simpler.
      
      Fixes: e0c9c0af mnt: Update detach_mounts to leave mounts connected
      Fixes: ce07d891 mnt: Honor MNT_LOCKED when detaching mounts
      Cc: stable@vger.kernel.org
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      f2d0a123
  21. 10 7月, 2015 1 次提交
    • E
      mnt: fs_fully_visible enforce noexec and nosuid if !SB_I_NOEXEC · 77b1a97d
      Eric W. Biederman 提交于
      The filesystems proc and sysfs do not have executable files do not
      have exectuable files today and portions of userspace break if we do
      enforce nosuid and noexec consistency of nosuid and noexec flags
      between previous mounts and new mounts of proc and sysfs.
      
      Add the code to enforce consistency of the nosuid and noexec flags,
      and use the presence of SB_I_NOEXEC to signal that there is no need to
      bother.
      
      This results in a completely userspace invisible change that makes it
      clear fs_fully_visible can only skip the enforcement of noexec and
      nosuid because it is known the filesystems in question do not support
      executables.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      77b1a97d
  22. 01 7月, 2015 3 次提交
    • E
      mnt: Update fs_fully_visible to test for permanently empty directories · 7236c85e
      Eric W. Biederman 提交于
      fs_fully_visible attempts to make fresh mounts of proc and sysfs give
      the mounter no more access to proc and sysfs than if they could have
      by creating a bind mount.  One aspect of proc and sysfs that makes
      this particularly tricky is that there are other filesystems that
      typically mount on top of proc and sysfs.  As those filesystems are
      mounted on empty directories in practice it is safe to ignore them.
      However testing to ensure filesystems are mounted on empty directories
      has not been something the in kernel data structures have supported so
      the current test for an empty directory which checks to see
      if nlink <= 2 is a bit lacking.
      
      proc and sysfs have recently been modified to use the new empty_dir
      infrastructure to create all of their dedicated mount points.  Instead
      of testing for S_ISDIR(inode->i_mode) && i_nlink <= 2 to see if a
      directory is empty, test for is_empty_dir_inode(inode).  That small
      change guaranteess mounts found on proc and sysfs really are safe to
      ignore, because the directories are not only empty but nothing can
      ever be added to them.  This guarantees there is nothing to worry
      about when mounting proc and sysfs.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      7236c85e
    • E
      vfs: Ignore unlocked mounts in fs_fully_visible · ceeb0e5d
      Eric W. Biederman 提交于
      Limit the mounts fs_fully_visible considers to locked mounts.
      Unlocked can always be unmounted so considering them adds hassle
      but no security benefit.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      ceeb0e5d
    • Y
      fs: use seq_open_private() for proc_mounts · ede1bf0d
      Yann Droneaud 提交于
      A patchset to remove support for passing pre-allocated struct seq_file to
      seq_open().  Such feature is undocumented and prone to error.
      
      In particular, if seq_release() is used in release handler, it will
      kfree() a pointer which was not allocated by seq_open().
      
      So this patchset drops support for pre-allocated struct seq_file: it's
      only of use in proc_namespace.c and can be easily replaced by using
      seq_open_private()/seq_release_private().
      
      Additionally, it documents the use of file->private_data to hold pointer
      to struct seq_file by seq_open().
      
      This patch (of 3):
      
      Since patch described below, from v2.6.15-rc1, seq_open() could use a
      struct seq_file already allocated by the caller if the pointer to the
      structure is stored in file->private_data before calling the function.
      
          Commit 1abe77b0
          Author: Al Viro <viro@zeniv.linux.org.uk>
          Date:   Mon Nov 7 17:15:34 2005 -0500
      
              [PATCH] allow callers of seq_open do allocation themselves
      
              Allow caller of seq_open() to kmalloc() seq_file + whatever else they
              want and set ->private_data to it.  seq_open() will then abstain from
              doing allocation itself.
      
      Such behavior is only used by mounts_open_common().
      
      In order to drop support for such uncommon feature, proc_mounts is
      converted to use seq_open_private(), which take care of allocating the
      proc_mounts structure, making it available through ->private in struct
      seq_file.
      
      Conversely, proc_mounts is converted to use seq_release_private(), in
      order to release the private structure allocated by seq_open_private().
      
      Then, ->private is used directly instead of proc_mounts() macro to access
      to the proc_mounts structure.
      
      Link: http://lkml.kernel.org/r/cover.1433193673.git.ydroneaud@opteya.comSigned-off-by: NYann Droneaud <ydroneaud@opteya.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ede1bf0d
  23. 04 6月, 2015 1 次提交
    • E
      mnt: Modify fs_fully_visible to deal with locked ro nodev and atime · 8c6cf9cc
      Eric W. Biederman 提交于
      Ignore an existing mount if the locked readonly, nodev or atime
      attributes are less permissive than the desired attributes
      of the new mount.
      
      On success ensure the new mount locks all of the same readonly, nodev and
      atime attributes as the old mount.
      
      The nosuid and noexec attributes are not checked here as this change
      is destined for stable and enforcing those attributes causes a
      regression in lxc and libvirt-lxc where those applications will not
      start and there are no known executables on sysfs or proc and no known
      way to create exectuables without code modifications
      
      Cc: stable@vger.kernel.org
      Fixes: e51db735 ("userns: Better restrictions on when proc and sysfs can be mounted")
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      8c6cf9cc
  24. 14 5月, 2015 1 次提交
    • E
      mnt: Refactor the logic for mounting sysfs and proc in a user namespace · 1b852bce
      Eric W. Biederman 提交于
      Fresh mounts of proc and sysfs are a very special case that works very
      much like a bind mount.  Unfortunately the current structure can not
      preserve the MNT_LOCK... mount flags.  Therefore refactor the logic
      into a form that can be modified to preserve those lock bits.
      
      Add a new filesystem flag FS_USERNS_VISIBLE that requires some mount
      of the filesystem be fully visible in the current mount namespace,
      before the filesystem may be mounted.
      
      Move the logic for calling fs_fully_visible from proc and sysfs into
      fs/namespace.c where it has greater access to mount namespace state.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      1b852bce
  25. 11 5月, 2015 1 次提交
    • A
      new helper: __legitimize_mnt() · 294d71ff
      Al Viro 提交于
      same as legitimize_mnt(), except that it does *not* drop and regain
      rcu_read_lock; return values are
      0  =>  grabbed a reference, we are fine
      1  =>  failed, just go away
      -1 =>  failed, go away and mntput(bastard) when outside of rcu_read_lock
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      294d71ff
  26. 10 5月, 2015 1 次提交
  27. 10 4月, 2015 2 次提交
    • E
      mnt: Update detach_mounts to leave mounts connected · e0c9c0af
      Eric W. Biederman 提交于
      Now that it is possible to lazily unmount an entire mount tree and
      leave the individual mounts connected to each other add a new flag
      UMOUNT_CONNECTED to umount_tree to force this behavior and use
      this flag in detach_mounts.
      
      This closes a bug where the deletion of a file or directory could
      trigger an unmount and reveal data under a mount point.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      e0c9c0af
    • E
      mnt: Fix the error check in __detach_mounts · f53e5797
      Eric W. Biederman 提交于
      lookup_mountpoint can return either NULL or an error value.
      Update the test in __detach_mounts to test for an error value
      to avoid pathological cases causing a NULL pointer dereferences.
      
      The callers of __detach_mounts should prevent it from ever being
      called on an unlinked dentry but don't take any chances.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      f53e5797