summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-05-08 16:36:50 -0500
committerSasha Levin <sasha.levin@oracle.com>2015-05-23 15:43:26 -0400
commit2c981af6c8ed75640a7058473aaf42732386836c (patch)
tree95700da8a19dade77d1c6805eebac30ab00ce4bc /fs
parentd4b113a8840776191189952a9d194cf7c034af35 (diff)
mnt: Fix fs_fully_visible to verify the root directory is visible
[ 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>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 07ba424181a5..64837e3f1a5c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -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.
*/