Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933132AbXBESZJ (ORCPT ); Mon, 5 Feb 2007 13:25:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933127AbXBESZF (ORCPT ); Mon, 5 Feb 2007 13:25:05 -0500 Received: from mail.suse.de ([195.135.220.2]:43280 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933111AbXBESY7 (ORCPT ); Mon, 5 Feb 2007 13:24:59 -0500 From: Tony Jones To: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, chrisw@sous-sol.org, Tony Jones , linux-security-module@vger.kernel.org, agruen@suse.de Date: Mon, 05 Feb 2007 10:23:58 -0800 Message-Id: <20070205182358.12164.66864.sendpatchset@ermintrude.int.wirex.com> In-Reply-To: <20070205182213.12164.40927.sendpatchset@ermintrude.int.wirex.com> References: <20070205182213.12164.40927.sendpatchset@ermintrude.int.wirex.com> Subject: [RFC 11/28] Pass struct vfsmount to the inode_symlink LSM hook. Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3736 Lines: 95 Pass struct vfsmount to the inode_symlink LSM hook. Signed-off-by: Tony Jones Signed-off-by: Andreas Gruenbacher Index: linux-2.6/fs/namei.c =================================================================== --- linux-2.6.orig/fs/namei.c +++ linux-2.6/fs/namei.c @@ -2196,7 +2196,7 @@ int vfs_symlink(struct inode *dir, struc if (!dir->i_op || !dir->i_op->symlink) return -EPERM; - error = security_inode_symlink(dir, dentry, oldname); + error = security_inode_symlink(dir, dentry, mnt, oldname); if (error) return error; Index: linux-2.6/include/linux/security.h =================================================================== --- linux-2.6.orig/include/linux/security.h +++ linux-2.6/include/linux/security.h @@ -301,6 +301,7 @@ struct request_sock; * Check the permission to create a symbolic link to a file. * @dir contains the inode structure of parent directory of the symbolic link. * @dentry contains the dentry structure of the symbolic link. + * @mnt is the vfsmount corresponding to @dentry (may be NULL). * @old_name contains the pathname of file. * Return 0 if permission is granted. * @inode_mkdir: @@ -1213,8 +1214,8 @@ struct security_operations { int (*inode_link) (struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry); int (*inode_unlink) (struct inode *dir, struct dentry *dentry); - int (*inode_symlink) (struct inode *dir, - struct dentry *dentry, const char *old_name); + int (*inode_symlink) (struct inode *dir, struct dentry *dentry, + struct vfsmount *mnt, const char *old_name); int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, struct vfsmount *mnt, int mode); int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); @@ -1644,11 +1645,12 @@ static inline int security_inode_unlink static inline int security_inode_symlink (struct inode *dir, struct dentry *dentry, + struct vfsmount *mnt, const char *old_name) { if (unlikely (IS_PRIVATE (dir))) return 0; - return security_ops->inode_symlink (dir, dentry, old_name); + return security_ops->inode_symlink (dir, dentry, mnt, old_name); } static inline int security_inode_mkdir (struct inode *dir, @@ -2369,6 +2371,7 @@ static inline int security_inode_unlink static inline int security_inode_symlink (struct inode *dir, struct dentry *dentry, + struct vfsmount *mnt, const char *old_name) { return 0; Index: linux-2.6/security/dummy.c =================================================================== --- linux-2.6.orig/security/dummy.c +++ linux-2.6/security/dummy.c @@ -282,7 +282,7 @@ static int dummy_inode_unlink (struct in } static int dummy_inode_symlink (struct inode *inode, struct dentry *dentry, - const char *name) + struct vfsmount *mnt, const char *name) { return 0; } Index: linux-2.6/security/selinux/hooks.c =================================================================== --- linux-2.6.orig/security/selinux/hooks.c +++ linux-2.6/security/selinux/hooks.c @@ -2161,7 +2161,8 @@ static int selinux_inode_unlink(struct i return may_link(dir, dentry, MAY_UNLINK); } -static int selinux_inode_symlink(struct inode *dir, struct dentry *dentry, const char *name) +static int selinux_inode_symlink(struct inode *dir, struct dentry *dentry, + struct vfsmount *mnt, const char *name) { return may_create(dir, dentry, SECCLASS_LNK_FILE); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/