diff options
| -rw-r--r-- | fs/stat.c | 2 | ||||
| -rw-r--r-- | include/linux/security.h | 7 | ||||
| -rw-r--r-- | security/apparmor/lsm.c | 6 | ||||
| -rw-r--r-- | security/capability.c | 2 | ||||
| -rw-r--r-- | security/security.c | 6 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 12 | ||||
| -rw-r--r-- | security/smack/smack_lsm.c | 13 | ||||
| -rw-r--r-- | security/tomoyo/common.h | 2 | ||||
| -rw-r--r-- | security/tomoyo/file.c | 4 | ||||
| -rw-r--r-- | security/tomoyo/tomoyo.c | 5 |
10 files changed, 24 insertions, 35 deletions
| @@ -66,7 +66,7 @@ int vfs_getattr(struct path *path, struct kstat *stat) | |||
| 66 | { | 66 | { |
| 67 | int retval; | 67 | int retval; |
| 68 | 68 | ||
| 69 | retval = security_inode_getattr(path->mnt, path->dentry); | 69 | retval = security_inode_getattr(path); |
| 70 | if (retval) | 70 | if (retval) |
| 71 | return retval; | 71 | return retval; |
| 72 | return vfs_getattr_nosec(path, stat); | 72 | return vfs_getattr_nosec(path, stat); |
diff --git a/include/linux/security.h b/include/linux/security.h index a1b7dbd127ff..4e14e3d6309f 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -1556,7 +1556,7 @@ struct security_operations { | |||
| 1556 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1556 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
| 1557 | int (*inode_permission) (struct inode *inode, int mask); | 1557 | int (*inode_permission) (struct inode *inode, int mask); |
| 1558 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); | 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 | int (*inode_setxattr) (struct dentry *dentry, const char *name, | 1560 | int (*inode_setxattr) (struct dentry *dentry, const char *name, |
| 1561 | const void *value, size_t size, int flags); | 1561 | const void *value, size_t size, int flags); |
| 1562 | void (*inode_post_setxattr) (struct dentry *dentry, const char *name, | 1562 | void (*inode_post_setxattr) (struct dentry *dentry, const char *name, |
| @@ -1843,7 +1843,7 @@ int security_inode_readlink(struct dentry *dentry); | |||
| 1843 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); | 1843 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); |
| 1844 | int security_inode_permission(struct inode *inode, int mask); | 1844 | int security_inode_permission(struct inode *inode, int mask); |
| 1845 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); | 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 | int security_inode_setxattr(struct dentry *dentry, const char *name, | 1847 | int security_inode_setxattr(struct dentry *dentry, const char *name, |
| 1848 | const void *value, size_t size, int flags); | 1848 | const void *value, size_t size, int flags); |
| 1849 | void security_inode_post_setxattr(struct dentry *dentry, const char *name, | 1849 | void security_inode_post_setxattr(struct dentry *dentry, const char *name, |
| @@ -2259,8 +2259,7 @@ static inline int security_inode_setattr(struct dentry *dentry, | |||
| 2259 | return 0; | 2259 | return 0; |
| 2260 | } | 2260 | } |
| 2261 | 2261 | ||
| 2262 | static inline int security_inode_getattr(struct vfsmount *mnt, | 2262 | static inline int security_inode_getattr(const struct path *path) |
| 2263 | struct dentry *dentry) | ||
| 2264 | { | 2263 | { |
| 2265 | return 0; | 2264 | return 0; |
| 2266 | } | 2265 | } |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 107db88b1d5f..dd56bffd6500 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
| @@ -364,12 +364,12 @@ static int apparmor_path_chown(struct path *path, kuid_t uid, kgid_t gid) | |||
| 364 | return common_perm(OP_CHOWN, path, AA_MAY_CHOWN, &cond); | 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 | return 0; | 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 | AA_MAY_META_READ); | 373 | AA_MAY_META_READ); |
| 374 | } | 374 | } |
| 375 | 375 | ||
diff --git a/security/capability.c b/security/capability.c index 070dd46f62f4..bdf22034a961 100644 --- a/security/capability.c +++ b/security/capability.c | |||
| @@ -225,7 +225,7 @@ static int cap_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 225 | return 0; | 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 | return 0; | 230 | return 0; |
| 231 | } | 231 | } |
diff --git a/security/security.c b/security/security.c index e81d5bbe7363..ed890c6d31c5 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -608,11 +608,11 @@ int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 608 | } | 608 | } |
| 609 | EXPORT_SYMBOL_GPL(security_inode_setattr); | 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 | return 0; | 614 | return 0; |
| 615 | return security_ops->inode_getattr(mnt, dentry); | 615 | return security_ops->inode_getattr(path); |
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | int security_inode_setxattr(struct dentry *dentry, const char *name, | 618 | int security_inode_setxattr(struct dentry *dentry, const char *name, |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4d1a54190388..e119cdcffc87 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -1623,7 +1623,7 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
| 1623 | the path to help the auditing code to more easily generate the | 1623 | the path to help the auditing code to more easily generate the |
| 1624 | pathname if needed. */ | 1624 | pathname if needed. */ |
| 1625 | static inline int path_has_perm(const struct cred *cred, | 1625 | static inline int path_has_perm(const struct cred *cred, |
| 1626 | struct path *path, | 1626 | const struct path *path, |
| 1627 | u32 av) | 1627 | u32 av) |
| 1628 | { | 1628 | { |
| 1629 | struct inode *inode = path->dentry->d_inode; | 1629 | struct inode *inode = path->dentry->d_inode; |
| @@ -2954,15 +2954,9 @@ static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 2954 | return dentry_has_perm(cred, dentry, av); | 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(); | 2959 | return path_has_perm(current_cred(), path, FILE__GETATTR); |
| 2960 | struct path path; | ||
| 2961 | |||
| 2962 | path.dentry = dentry; | ||
| 2963 | path.mnt = mnt; | ||
| 2964 | |||
| 2965 | return path_has_perm(cred, &path, FILE__GETATTR); | ||
| 2966 | } | 2960 | } |
| 2967 | 2961 | ||
| 2968 | static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name) | 2962 | static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name) |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index c934311812f1..1511965549b8 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -1034,19 +1034,16 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1034 | * | 1034 | * |
| 1035 | * Returns 0 if access is permitted, an error code otherwise | 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 | struct smk_audit_info ad; | 1039 | struct smk_audit_info ad; |
| 1040 | struct path path; | 1040 | struct inode *inode = path->dentry->d_inode; |
| 1041 | int rc; | 1041 | int rc; |
| 1042 | 1042 | ||
| 1043 | path.dentry = dentry; | ||
| 1044 | path.mnt = mnt; | ||
| 1045 | |||
| 1046 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); | 1043 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); |
| 1047 | smk_ad_setfield_u_fs_path(&ad, path); | 1044 | smk_ad_setfield_u_fs_path(&ad, *path); |
| 1048 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_READ, &ad); | 1045 | rc = smk_curacc(smk_of_inode(inode), MAY_READ, &ad); |
| 1049 | rc = smk_bu_inode(dentry->d_inode, MAY_READ, rc); | 1046 | rc = smk_bu_inode(inode, MAY_READ, rc); |
| 1050 | return rc; | 1047 | return rc; |
| 1051 | } | 1048 | } |
| 1052 | 1049 | ||
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index 6627102c24af..f9c9fb1d56b4 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
| @@ -978,7 +978,7 @@ int tomoyo_path2_perm(const u8 operation, struct path *path1, | |||
| 978 | struct path *path2); | 978 | struct path *path2); |
| 979 | int tomoyo_path_number_perm(const u8 operation, struct path *path, | 979 | int tomoyo_path_number_perm(const u8 operation, struct path *path, |
| 980 | unsigned long number); | 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, |
