From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945963AbXDLJul (ORCPT ); Thu, 12 Apr 2007 05:50:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1945985AbXDLJtU (ORCPT ); Thu, 12 Apr 2007 05:49:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:56731 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1945963AbXDLJkd (ORCPT ); Thu, 12 Apr 2007 05:40:33 -0400 Message-Id: <20070412090845.629737000@suse.de> References: <20070412090809.917795000@suse.de> User-Agent: quilt/0.46-14 Date: Thu, 12 Apr 2007 02:08:37 -0700 From: jjohansen@suse.de To: linux-kernel@vger.kernel.org Cc: linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, chrisw@sous-sol.org, Tony Jones , Andreas Gruenbacher , John Johansen Subject: [AppArmor 28/41] Pass struct vfsmount to the inode_listxattr LSM hook Content-Disposition: inline; filename=security-listxattr.diff Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This is needed for computing pathnames in the AppArmor LSM. Signed-off-by: Tony Jones Signed-off-by: Andreas Gruenbacher Signed-off-by: John Johansen --- fs/xattr.c | 2 +- include/linux/security.h | 12 +++++++----- security/dummy.c | 2 +- security/selinux/hooks.c | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) --- a/fs/xattr.c +++ b/fs/xattr.c @@ -150,7 +150,7 @@ vfs_listxattr(struct dentry *dentry, str struct inode *inode = dentry->d_inode; ssize_t error; - error = security_inode_listxattr(dentry); + error = security_inode_listxattr(dentry, mnt); if (error) return error; error = -EOPNOTSUPP; --- a/include/linux/security.h +++ b/include/linux/security.h @@ -395,7 +395,7 @@ struct request_sock; * Return 0 if permission is granted. * @inode_listxattr: * Check permission before obtaining the list of extended attribute - * names for @dentry. + * names for @dentry and @mnt. * Return 0 if permission is granted. * @inode_removexattr: * Check permission before removing the extended attribute @@ -1250,7 +1250,7 @@ struct security_operations { size_t size, int flags); int (*inode_getxattr) (struct dentry *dentry, struct vfsmount *mnt, char *name); - int (*inode_listxattr) (struct dentry *dentry); + int (*inode_listxattr) (struct dentry *dentry, struct vfsmount *mnt); int (*inode_removexattr) (struct dentry *dentry, char *name); const char *(*inode_xattr_getsuffix) (void); int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err); @@ -1791,11 +1791,12 @@ static inline int security_inode_getxatt return security_ops->inode_getxattr (dentry, mnt, name); } -static inline int security_inode_listxattr (struct dentry *dentry) +static inline int security_inode_listxattr (struct dentry *dentry, + struct vfsmount *mnt) { if (unlikely (IS_PRIVATE (dentry->d_inode))) return 0; - return security_ops->inode_listxattr (dentry); + return security_ops->inode_listxattr (dentry, mnt); } static inline int security_inode_removexattr (struct dentry *dentry, char *name) @@ -2495,7 +2496,8 @@ static inline int security_inode_getxatt return 0; } -static inline int security_inode_listxattr (struct dentry *dentry) +static inline int security_inode_listxattr (struct dentry *dentry, + struct vfsmount *mnt) { return 0; } --- a/security/dummy.c +++ b/security/dummy.c @@ -374,7 +374,7 @@ static int dummy_inode_getxattr (struct return 0; } -static int dummy_inode_listxattr (struct dentry *dentry) +static int dummy_inode_listxattr (struct dentry *dentry, struct vfsmount *mnt) { return 0; } --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2401,7 +2401,7 @@ static int selinux_inode_getxattr (struc return dentry_has_perm(current, NULL, dentry, FILE__GETATTR); } -static int selinux_inode_listxattr (struct dentry *dentry) +static int selinux_inode_listxattr (struct dentry *dentry, struct vfsmount *mnt) { return dentry_has_perm(current, NULL, dentry, FILE__GETATTR); } --