aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-03-08 19:28:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:24:32 -0400
commit3f7036a071b879da017eddaedb10fba173fdf1ff (patch)
tree2160617c1812915583de79d2ee85913eb247e2a4 /security
parent2247386243747500977dc92b1ab833401303f9f0 (diff)
switch security_inode_getattr() to struct path *
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/lsm.c6
-rw-r--r--security/capability.c2
-rw-r--r--security/security.c6
-rw-r--r--security/selinux/hooks.c12
-rw-r--r--security/smack/smack_lsm.c13
-rw-r--r--security/tomoyo/common.h2
-rw-r--r--security/tomoyo/file.c4
-rw-r--r--security/tomoyo/tomoyo.c5
8 files changed, 20 insertions, 30 deletions
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
367static int apparmor_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 367static 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
228static int cap_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 228static 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}
609EXPORT_SYMBOL_GPL(security_inode_setattr); 609EXPORT_SYMBOL_GPL(security_inode_setattr);
610 610
611int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 611int 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
618int security_inode_setxattr(struct dentry *dentry, const char *name, 618int 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. */
1625static inline int path_has_perm(const struct cred *cred, 1625static 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
2957static int selinux_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 2957static 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
2968static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name) 2962static 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 */
1037static int smack_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 1037static 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);
979int tomoyo_path_number_perm(const u8 operation, struct path *path, 979int tomoyo_path_number_perm(const u8 operation, struct path *path,
980 unsigned long number); 980 unsigned long number);
981int tomoyo_path_perm(const u8 operation, struct path *path, 981int tomoyo_path_perm(const u8 operation, const struct path *path,
982 const char *target); 982 const char *target);
983unsigned int tomoyo_poll_control(struct file *file, poll_table *wait); 983unsigned int tomoyo_poll_control(struct file *file, poll_table *wait);
984unsigned int tomoyo_poll_log(struct file *file, poll_table *wait); 984unsigned int tomoyo_poll_log(struct file *file, poll_table *wait);
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index c151a1869597..2367b100cc62 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -145,7 +145,7 @@ static void tomoyo_add_slash(struct tomoyo_path_info *buf)
145 * 145 *
146 * Returns true on success, false otherwise. 146 * Returns true on success, false otherwise.
147 */ 147 */
148static bool tomoyo_get_realpath(struct tomoyo_path_info *buf, struct path *path) 148static bool tomoyo_get_realpath(struct tomoyo_path_info *buf, const struct path *path)
149{ 149{
150 buf->name = tomoyo_realpath_from_path(path); 150 buf->name = tomoyo_realpath_from_path(path);
151 if (buf->name) { 151 if (buf->name) {
@@ -782,7 +782,7 @@ int tomoyo_check_open_permission(struct tomoyo_domain_info *domain,
782 * 782 *
783 * Returns 0 on success, negative value otherwise. 783 * Returns 0 on success, negative value otherwise.
784 */ 784 */
785int tomoyo_path_perm(const u8 operation, struct path *path, const char *target) 785int tomoyo_path_perm(const u8 operation, const struct path *path, const char *target)
786{ 786{
787 struct tomoyo_request_info r; 787 struct tomoyo_request_info r;
788 struct tomoyo_obj_info obj = { 788 struct tomoyo_obj_info obj = {
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index f0b756e27fed..57c88d52ffa5 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -144,10 +144,9 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm)
144 * 144 *
145 * Returns 0 on success, negative value otherwise. 145 * Returns 0 on success, negative value otherwise.
146 */ 146 */
147static int tomoyo_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) 147static int tomoyo_inode_getattr(const struct path *path)
148{ 148{
149 struct path path = { mnt, dentry }; 149 return tomoyo_path_perm(TOMOYO_TYPE_GETATTR, path, NULL);
150 return tomoyo_path_perm(TOMOYO_TYPE_GETATTR, &path, NULL);
151} 150}
152 151
153/** 152/**