Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

switch security_inode_getattr() to struct path *

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 3f7036a0 22473862

+24 -35
+1 -1
fs/stat.c
··· 66 66 { 67 67 int retval; 68 68 69 - retval = security_inode_getattr(path->mnt, path->dentry); 69 + retval = security_inode_getattr(path); 70 70 if (retval) 71 71 return retval; 72 72 return vfs_getattr_nosec(path, stat);
+3 -4
include/linux/security.h
··· 1556 1556 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1557 1557 int (*inode_permission) (struct inode *inode, int mask); 1558 1558 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1559 - int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1559 + int (*inode_getattr) (const struct path *path); 1560 1560 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1561 1561 const void *value, size_t size, int flags); 1562 1562 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, ··· 1843 1843 int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1844 1844 int security_inode_permission(struct inode *inode, int mask); 1845 1845 int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1846 - int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1846 + int security_inode_getattr(const struct path *path); 1847 1847 int security_inode_setxattr(struct dentry *dentry, const char *name, 1848 1848 const void *value, size_t size, int flags); 1849 1849 void security_inode_post_setxattr(struct dentry *dentry, const char *name, ··· 2259 2259 return 0; 2260 2260 } 2261 2261 2262 - static inline int security_inode_getattr(struct vfsmount *mnt, 2263 - struct dentry *dentry) 2262 + static inline int security_inode_getattr(const struct path *path) 2264 2263 { 2265 2264 return 0; 2266 2265 }
+3 -3
security/apparmor/lsm.c
··· 364 364 return common_perm(OP_CHOWN, path, AA_MAY_CHOWN, &cond); 365 365 } 366 366 367 - static int apparmor_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 367 + static int apparmor_inode_getattr(const struct path *path) 368 368 { 369 - if (!mediated_filesystem(dentry)) 369 + if (!mediated_filesystem(path->dentry)) 370 370 return 0; 371 371 372 - return common_perm_mnt_dentry(OP_GETATTR, mnt, dentry, 372 + return common_perm_mnt_dentry(OP_GETATTR, path->mnt, path->dentry, 373 373 AA_MAY_META_READ); 374 374 } 375 375
+1 -1
security/capability.c
··· 225 225 return 0; 226 226 } 227 227 228 - static int cap_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 228 + static int cap_inode_getattr(const struct path *path) 229 229 { 230 230 return 0; 231 231 }
+3 -3
security/security.c
··· 608 608 } 609 609 EXPORT_SYMBOL_GPL(security_inode_setattr); 610 610 611 - int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 611 + int security_inode_getattr(const struct path *path) 612 612 { 613 - if (unlikely(IS_PRIVATE(dentry->d_inode))) 613 + if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 614 614 return 0; 615 - return security_ops->inode_getattr(mnt, dentry); 615 + return security_ops->inode_getattr(path); 616 616 } 617 617 618 618 int security_inode_setxattr(struct dentry *dentry, const char *name,
+3 -9
security/selinux/hooks.c
··· 1623 1623 the path to help the auditing code to more easily generate the 1624 1624 pathname if needed. */ 1625 1625 static inline int path_has_perm(const struct cred *cred, 1626 - struct path *path, 1626 + const struct path *path, 1627 1627 u32 av) 1628 1628 { 1629 1629 struct inode *inode = path->dentry->d_inode; ··· 2954 2954 return dentry_has_perm(cred, dentry, av); 2955 2955 } 2956 2956 2957 - static int selinux_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 2957 + static int selinux_inode_getattr(const struct path *path) 2958 2958 { 2959 - const struct cred *cred = current_cred(); 2960 - struct path path; 2961 - 2962 - path.dentry = dentry; 2963 - path.mnt = mnt; 2964 - 2965 - return path_has_perm(cred, &path, FILE__GETATTR); 2959 + return path_has_perm(current_cred(), path, FILE__GETATTR); 2966 2960 } 2967 2961 2968 2962 static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name)
+5 -8
security/smack/smack_lsm.c
··· 1034 1034 * 1035 1035 * Returns 0 if access is permitted, an error code otherwise 1036 1036 */ 1037 - static int smack_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 1037 + static int smack_inode_getattr(const struct path *path) 1038 1038 { 1039 1039 struct smk_audit_info ad; 1040 - struct path path; 1040 + struct inode *inode = path->dentry->d_inode; 1041 1041 int rc; 1042 1042 1043 - path.dentry = dentry; 1044 - path.mnt = mnt; 1045 - 1046 1043 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); 1047 - smk_ad_setfield_u_fs_path(&ad, path); 1048 - rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_READ, &ad); 1049 - rc = smk_bu_inode(dentry->d_inode, MAY_READ, rc); 1044 + smk_ad_setfield_u_fs_path(&ad, *path); 1045 + rc = smk_curacc(smk_of_inode(inode), MAY_READ, &ad); 1046 + rc = smk_bu_inode(inode, MAY_READ, rc); 1050 1047 return rc; 1051 1048 } 1052 1049
+1 -1
security/tomoyo/common.h
··· 978 978 struct path *path2); 979 979 int tomoyo_path_number_perm(const u8 operation, struct path *path, 980 980 unsigned long number); 981 - int tomoyo_path_perm(const u8 operation, struct path *path, 981 + int tomoyo_path_perm(const u8 operation, const struct path *path, 982 982 const char *target); 983 983 unsigned int tomoyo_poll_control(struct file *file, poll_table *wait); 984 984 unsigned int tomoyo_poll_log(struct file *file, poll_table *wait);
+2 -2
security/tomoyo/file.c
··· 145 145 * 146 146 * Returns true on success, false otherwise. 147 147 */ 148 - static bool tomoyo_get_realpath(struct tomoyo_path_info *buf, struct path *path) 148 + static bool tomoyo_get_realpath(struct tomoyo_path_info *buf, const struct path *path) 149 149 { 150 150 buf->name = tomoyo_realpath_from_path(path); 151 151 if (buf->name) { ··· 782 782 * 783 783 * Returns 0 on success, negative value otherwise. 784 784 */ 785 - int tomoyo_path_perm(const u8 operation, struct path *path, const char *target) 785 + int tomoyo_path_perm(const u8 operation, const struct path *path, const char *target) 786 786 { 787 787 struct tomoyo_request_info r; 788 788 struct tomoyo_obj_info obj = {
+2 -3
security/tomoyo/tomoyo.c
··· 144 144 * 145 145 * Returns 0 on success, negative value otherwise. 146 146 */ 147 - static int tomoyo_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 147 + static int tomoyo_inode_getattr(const struct path *path) 148 148 { 149 - struct path path = { mnt, dentry }; 150 - return tomoyo_path_perm(TOMOYO_TYPE_GETATTR, &path, NULL); 149 + return tomoyo_path_perm(TOMOYO_TYPE_GETATTR, path, NULL); 151 150 } 152 151 153 152 /**