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>
Subject: [RFD Patch 3/4] Dont use a NULL nameidata in xattr_permission()
Date: Mon, 14 May 2007 04:06:53 -0700 [thread overview]
Message-ID: <20070514110651.929217256@suse.de> (raw)
In-Reply-To: 20070514110650.866217377@suse.de
[-- Attachment #1: xattr_permission.diff --]
[-- Type: text/plain, Size: 1736 bytes --]
Create nameidata2 struct xattr_permission so that it does not pass NULL
to permission.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
---
fs/xattr.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -25,8 +25,16 @@
* because different namespaces have very different rules.
*/
static int
-xattr_permission(struct inode *inode, const char *name, int mask)
+xattr_permission(struct dentry *dentry, struct vfsmount *mnt, const char *name,
+ int mask)
{
+ struct inode *inode = dentry->d_inode;
+ struct nameidata2 nd;
+
+ nd.dentry = dentry;
+ nd.mnt = mnt;
+ nd.flags = 0;
+
/*
* We can never set or remove an extended attribute on a read-only
* filesystem or on an immutable / append-only inode.
@@ -65,7 +73,7 @@ xattr_permission(struct inode *inode, co
return -EPERM;
}
- return permission(inode, mask, NULL);
+ return permission(inode, mask, &nd);
}
int
@@ -75,7 +83,7 @@ vfs_setxattr(struct dentry *dentry, stru
struct inode *inode = dentry->d_inode;
int error;
- error = xattr_permission(inode, name, MAY_WRITE);
+ error = xattr_permission(dentry, mnt, name, MAY_WRITE);
if (error)
return error;
@@ -112,7 +120,7 @@ vfs_getxattr(struct dentry *dentry, stru
struct inode *inode = dentry->d_inode;
int error;
- error = xattr_permission(inode, name, MAY_READ);
+ error = xattr_permission(dentry, mnt, name, MAY_READ);
if (error)
return error;
@@ -174,7 +182,7 @@ vfs_removexattr(struct dentry *dentry, s
if (!inode->i_op->removexattr)
return -EOPNOTSUPP;
- error = xattr_permission(inode, name, MAY_WRITE);
+ error = xattr_permission(dentry, mnt, name, MAY_WRITE);
if (error)
return error;
--
next prev parent reply other threads:[~2007-05-14 11:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 11:06 [RFD Patch 0/4] AppArmor - Don't pass NULL nameidata to vfs_create/lookup/permission IOPs jjohansen
2007-05-14 11:06 ` [RFD Patch 1/4] Pass no useless nameidata to the create, lookup, and permission IOPs jjohansen
2007-05-14 11:06 ` [RFD Patch 2/4] Never pass a NULL nameidata to vfs_create() jjohansen
2007-05-14 11:06 ` jjohansen [this message]
2007-05-14 11:06 ` [RFD Patch 4/4] Pass nameidata2 to permission() from nfsd_permission() jjohansen
2007-05-14 13:51 ` [RFD Patch 0/4] AppArmor - Don't pass NULL nameidata to vfs_create/lookup/permission IOPs John Johansen
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=20070514110651.929217256@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).