mnt: fs_fully_visible test the proper mount for MNT_LOCKED
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 27 May 2016 19:50:05 +0000 (14:50 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 7 Jun 2016 01:52:03 +0000 (20:52 -0500)
MNT_LOCKED implies on a child mount implies the child is locked to the
parent.  So while looping through the children the children should be
tested (not their parent).

Typically an unshare of a mount namespace locks all mounts together
making both the parent and the slave as locked but there are a few
corner cases where other things work.

Cc: stable@vger.kernel.org
Fixes: ceeb0e5d39fc ("vfs: Ignore unlocked mounts in fs_fully_visible")
Reported-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/namespace.c

index 9d45c8a3414f7682e421db6de39c4b55c3b85e9a..a7ec92c051f5409da4ef23aab35030d230b975da 100644 (file)
@@ -3273,7 +3273,7 @@ static bool fs_fully_visible(struct file_system_type *type, int *new_mnt_flags)
                list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
                        struct inode *inode = child->mnt_mountpoint->d_inode;
                        /* Only worry about locked mounts */
-                       if (!(mnt_flags & MNT_LOCKED))
+                       if (!(child->mnt.mnt_flags & MNT_LOCKED))
                                continue;
                        /* Is the directory permanetly empty? */
                        if (!is_empty_dir_inode(inode))