Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752141AbcDOPqs (ORCPT ); Fri, 15 Apr 2016 11:46:48 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:37280 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbcDOPqn (ORCPT ); Fri, 15 Apr 2016 11:46:43 -0400 From: "Eric W. Biederman" To: Linus Torvalds Cc: "H. Peter Anvin" , Andy Lutomirski , security@debian.org, security@kernel.org, Al Viro , security@ubuntu.com, Peter Hurley , Serge Hallyn , Willy Tarreau , Aurelien Jarno , One Thousand Gnomes , Jann Horn , Greg KH , Linux Kernel Mailing List , Jiri Slaby , Florian Weimer , "Eric W. Biederman" Date: Fri, 15 Apr 2016 10:35:19 -0500 Message-Id: <1460734532-20134-3-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1460734532-20134-1-git-send-email-ebiederm@xmission.com> References: <877ffyzy1j.fsf_-_@x220.int.ebiederm.org> <1460734532-20134-1-git-send-email-ebiederm@xmission.com> X-XM-AID: U2FsdGVkX19DfLLnf++rcKFD1kN/VlJNdp3RbsdZbQg= X-SA-Exim-Connect-IP: 67.3.249.252 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 263 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.2 (1.2%), b_tie_ro: 2.3 (0.9%), parse: 0.65 (0.2%), extract_message_metadata: 11 (4.4%), get_uri_detail_list: 0.95 (0.4%), tests_pri_-1000: 6 (2.3%), tests_pri_-950: 1.18 (0.4%), tests_pri_-900: 1.01 (0.4%), tests_pri_-400: 19 (7.4%), check_bayes: 18 (6.9%), b_tokenize: 6 (2.2%), b_tok_get_all: 6 (2.1%), b_comp_prob: 1.47 (0.6%), b_tok_touch_all: 3.1 (1.2%), b_finish: 0.68 (0.3%), tests_pri_0: 214 (81.3%), check_dkim_signature: 0.43 (0.2%), check_dkim_adsp: 3.1 (1.2%), tests_pri_500: 3.9 (1.5%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 03/16] vfs: Implement vfs_loopback_mount X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1261 Lines: 42 Add a helper to turn a struct path into a mount. Signed-off-by: "Eric W. Biederman" --- fs/namespace.c | 9 +++++++++ include/linux/mount.h | 1 + 2 files changed, 10 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index 4fb1691b4355..714778360c2b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1047,6 +1047,15 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, return ERR_PTR(err); } +struct vfsmount *vfs_loopback_mount(struct path *path) +{ + struct mount *p; + p = clone_mnt(real_mount(path->mnt), path->dentry, 0); + if (IS_ERR(p)) + return ERR_CAST(p); + return &p->mnt; +} + static void cleanup_mnt(struct mount *mnt) { /* diff --git a/include/linux/mount.h b/include/linux/mount.h index f822c3c11377..8f6039ad898e 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -89,6 +89,7 @@ struct file_system_type; extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data); +struct vfsmount *vfs_loopback_mount(struct path *path); extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list); extern void mark_mounts_for_expiry(struct list_head *mounts); -- 2.8.1