]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mnt: Fix fs_fully_visible to verify the root directory is visible
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 8 May 2015 21:36:50 +0000 (16:36 -0500)
committerSasha Levin <sasha.levin@oracle.com>
Sat, 23 May 2015 19:43:26 +0000 (15:43 -0400)
[ Upstream commit 7e96c1b0e0f495c5a7450dc4aa7c9a24ba4305bd ]

This fixes a dumb bug in fs_fully_visible that allows proc or sys to
be mounted if there is a bind mount of part of /proc/ or /sys/ visible.

Cc: stable@vger.kernel.org
Reported-by: Eric Windisch <ewindisch@docker.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/namespace.c

index 07ba424181a5570209cdb9bd4d7841b64d0797d4..64837e3f1a5c7ca466952d0a5623546356f6fa40 100644 (file)
@@ -3137,6 +3137,12 @@ bool fs_fully_visible(struct file_system_type *type)
                if (mnt->mnt.mnt_sb->s_type != type)
                        continue;
 
+               /* This mount is not fully visible if it's root directory
+                * is not the root directory of the filesystem.
+                */
+               if (mnt->mnt.mnt_root != mnt->mnt.mnt_sb->s_root)
+                       continue;
+
                /* This mount is not fully visible if there are any child mounts
                 * that cover anything except for empty directories.
                 */