From mboxrd@z Thu Jan 1 00:00:00 1970 From: Valerie Aurora Subject: [PATCH 42/74] union-mount: Prevent bind mounts of union mounts Date: Tue, 22 Mar 2011 18:59:18 -0700 Message-ID: <1300845590-14184-43-git-send-email-valerie.aurora@gmail.com> References: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Cc: viro@zeniv.linux.org.uk, Valerie Aurora , Valerie Aurora To: linux-fsdevel@vger.kernel.org, linux@vger.kernel.org Return-path: Received: from mail-iw0-f174.google.com ([209.85.214.174]:34602 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756604Ab1CWCCH (ORCPT ); Tue, 22 Mar 2011 22:02:07 -0400 In-Reply-To: <1300845590-14184-1-git-send-email-valerie.aurora@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Valerie Aurora Prevent bind mounts of parts of union mounts. XXX - Bind mounting parts of union mounts is probably easy to implement, but requires some careful thought about corner cases, extensive testing, and some refactoring of the code. Signed-off-by: Valerie Aurora --- fs/namespace.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 3ac8198..1581411 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1806,6 +1806,12 @@ static int do_loopback(struct path *path, char *old_name, err = -EINVAL; if (IS_MNT_UNBINDABLE(old_path.mnt)) goto out; + /* + * XXX - Mounting a subtree of a union mount elsewhere + * requires careful thought and some refactoring. + */ + if (IS_MNT_UNION(old_path.mnt)) + goto out; if (!check_mnt(path->mnt) || !check_mnt(old_path.mnt)) goto out; -- 1.7.0.4