From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: [patch 03/10] apparmor: use task path helpers Date: Wed, 18 Aug 2010 04:37:32 +1000 Message-ID: <20100817184120.622515715@kernel.dk> References: <20100817183729.613117146@kernel.dk> Cc: linux-fsdevel@vger.kernel.org To: Al Viro Return-path: Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:56292 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759181Ab0HQStO (ORCPT ); Tue, 17 Aug 2010 14:49:14 -0400 Content-Disposition: inline; filename=apparmor-use-path-helpers.patch Sender: linux-fsdevel-owner@vger.kernel.org List-ID: apparmor: use task path helpers Signed-off-by: Nick Piggin --- BTW, argh! dcache_lock! Why does everything have to invent its own reverse path lookup crud and hide it away in its own code? Also, admire the rest of this beautiful function. --- security/apparmor/path.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) Index: linux-2.6/security/apparmor/path.c =================================================================== --- linux-2.6.orig/security/apparmor/path.c 2010-08-18 04:04:02.000000000 +1000 +++ linux-2.6/security/apparmor/path.c 2010-08-18 04:04:29.000000000 +1000 @@ -62,19 +62,14 @@ static int d_namespace_path(struct path int deleted, connected; int error = 0; - /* Get the root we want to resolve too */ + /* Get the root we want to resolve too, released below */ if (flags & PATH_CHROOT_REL) { /* resolve paths relative to chroot */ - read_lock(¤t->fs->lock); - root = current->fs->root; - /* released below */ - path_get(&root); - read_unlock(¤t->fs->lock); + get_fs_root(current->fs, &root); } else { /* resolve paths relative to namespace */ root.mnt = current->nsproxy->mnt_ns->root; root.dentry = root.mnt->mnt_root; - /* released below */ path_get(&root); }