From: jjohansen@suse.de
To: linux-kernel@vger.kernel.org
Cc: linux-security-module@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
Andreas Gruenbacher <agruen@suse.de>,
John Johansen <jjohansen@suse.de>
Subject: [RFD 4/4] Pass nameidata2 to permission() from nfsd_permission()
Date: Tue, 26 Jun 2007 16:15:14 -0700 [thread overview]
Message-ID: <20070626231552.962599112@suse.de> (raw)
In-Reply-To: 20070626231510.883881222@suse.de
[-- Attachment #1: nfsd_permission-nameidata.diff --]
[-- Type: text/plain, Size: 1301 bytes --]
Construct a nameidata object and pass it down to permission(), so
that we can do the proper mount flag checks there.
Note that confining nfsd with AppArmor makes no sense, and so this
patch is not necessary for AppArmor alone.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: John Johansen <jjohansen@suse.de>
---
fs/nfsd/vfs.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1804,6 +1804,7 @@ nfsd_statfs(struct svc_rqst *rqstp, stru
__be32
nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc)
{
+ struct nameidata2 nd;
struct inode *inode = dentry->d_inode;
int err;
@@ -1869,12 +1870,16 @@ nfsd_permission(struct svc_export *exp,
inode->i_uid == current->fsuid)
return 0;
- err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC), NULL);
+ nd.dentry = dentry;
+ nd.mnt = exp->ex_mnt;
+ nd.flags = LOOKUP_ACCESS;
+
+ err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC), &nd);
/* Allow read access to binaries even when mode 111 */
if (err == -EACCES && S_ISREG(inode->i_mode) &&
acc == (MAY_READ | MAY_OWNER_OVERRIDE))
- err = permission(inode, MAY_EXEC, NULL);
+ err = permission(inode, MAY_EXEC, &nd);
return err? nfserrno(err) : 0;
}
--
next prev parent reply other threads:[~2007-06-26 23:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-26 23:15 [RFD 0/4] AppArmor - Don't pass NULL nameidata to vfs_create/lookup/permission IOPs jjohansen
2007-06-26 23:15 ` [RFD 1/4] Pass no useless nameidata to the create, lookup, and permission IOPs jjohansen
2007-06-27 0:11 ` Erez Zadok
2007-06-30 9:14 ` Christoph Hellwig
2007-06-30 9:13 ` Christoph Hellwig
2007-06-30 16:13 ` Andreas Gruenbacher
2007-06-26 23:15 ` [RFD 2/4] Never pass a NULL nameidata to vfs_create() jjohansen
2007-06-26 23:15 ` [RFD 3/4] Dont use a NULL nameidata in xattr_permission() jjohansen
2007-06-26 23:15 ` jjohansen [this message]
2007-06-26 23:46 ` [RFD 0/4] AppArmor - Don't pass NULL nameidata to vfs_create/lookup/permission IOPs Trond Myklebust
2007-06-27 20:42 ` Andreas Gruenbacher
2007-06-30 9:15 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070626231552.962599112@suse.de \
--to=jjohansen@suse.de \
--cc=agruen@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).