Return-Path: Received: from mail-wi0-f169.google.com ([209.85.212.169]:37774 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831AbbG0IWT (ORCPT ); Mon, 27 Jul 2015 04:22:19 -0400 Received: by wibud3 with SMTP id ud3so104376323wib.0 for ; Mon, 27 Jul 2015 01:22:18 -0700 (PDT) Received: from ?IPv6:2a01:4240:53f0:43fb::cbb? (b.b.c.0.0.0.0.0.0.0.0.0.0.0.0.0.b.f.3.4.0.f.3.5.0.4.2.4.1.0.a.2.v6.cust.nbox.cz. [2a01:4240:53f0:43fb::cbb]) by smtp.gmail.com with ESMTPSA id 4sm26531490wjt.46.2015.07.27.01.22.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 01:22:17 -0700 (PDT) From: "Jiri Slaby" To: Cc: "Eric W. Biederman" Subject: [patch added to the 3.12 stable tree] vfs: Ignore unlocked mounts in fs_fully_visible Date: Mon, 27 Jul 2015 10:02:11 +0200 Message-Id: <1437984150-15702-30-git-send-email-jslaby@suse.com> In-Reply-To: <1437984150-15702-1-git-send-email-jslaby@suse.com> References: <1437984150-15702-1-git-send-email-jslaby@suse.com> Sender: stable-owner@vger.kernel.org List-ID: From: "Eric W. Biederman" This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit ceeb0e5d39fcdf4dca2c997bf225c7fc49200b37 upstream. Limit the mounts fs_fully_visible considers to locked mounts. Unlocked can always be unmounted so considering them adds hassle but no security benefit. Signed-off-by: "Eric W. Biederman" Signed-off-by: Jiri Slaby --- fs/namespace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 9ae6837ef5bf..bdc6223a7500 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2939,11 +2939,15 @@ bool fs_fully_visible(struct file_system_type *type) 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. + /* This mount is not fully visible if there are any + * locked child mounts that cover anything except for + * empty directories. */ 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->mnt.mnt_flags & MNT_LOCKED)) + continue; if (!S_ISDIR(inode->i_mode)) goto next; if (inode->i_nlink > 2) -- 2.4.6