Skip to content

Commit 314a8dc

Browse files
robertosassupcmoore
authored andcommitted
security: Align inode_setattr hook definition with EVM
Add the idmap parameter to the definition, so that evm_inode_setattr() can be registered as this hook implementation. Signed-off-by: Roberto Sassu <[email protected]> Reviewed-by: Stefan Berger <[email protected]> Acked-by: Casey Schaufler <[email protected]> Reviewed-by: Mimi Zohar <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 779cb19 commit 314a8dc

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

include/linux/lsm_hook_defs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry)
135135
LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode,
136136
bool rcu)
137137
LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask)
138-
LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr)
138+
LSM_HOOK(int, 0, inode_setattr, struct mnt_idmap *idmap, struct dentry *dentry,
139+
struct iattr *attr)
139140
LSM_HOOK(int, 0, inode_getattr, const struct path *path)
140141
LSM_HOOK(int, 0, inode_setxattr, struct mnt_idmap *idmap,
141142
struct dentry *dentry, const char *name, const void *value,

security/security.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ int security_inode_setattr(struct mnt_idmap *idmap,
22152215

22162216
if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
22172217
return 0;
2218-
ret = call_int_hook(inode_setattr, 0, dentry, attr);
2218+
ret = call_int_hook(inode_setattr, 0, idmap, dentry, attr);
22192219
if (ret)
22202220
return ret;
22212221
return evm_inode_setattr(idmap, dentry, attr);

security/selinux/hooks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3136,7 +3136,8 @@ static int selinux_inode_permission(struct inode *inode, int mask)
31363136
return rc;
31373137
}
31383138

3139-
static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
3139+
static int selinux_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
3140+
struct iattr *iattr)
31403141
{
31413142
const struct cred *cred = current_cred();
31423143
struct inode *inode = d_backing_inode(dentry);

security/smack/smack_lsm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,12 +1233,14 @@ static int smack_inode_permission(struct inode *inode, int mask)
12331233

12341234
/**
12351235
* smack_inode_setattr - Smack check for setting attributes
1236+
* @idmap: idmap of the mount
12361237
* @dentry: the object
12371238
* @iattr: for the force flag
12381239
*
12391240
* Returns 0 if access is permitted, an error code otherwise
12401241
*/
1241-
static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr)
1242+
static int smack_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
1243+
struct iattr *iattr)
12421244
{
12431245
struct smk_audit_info ad;
12441246
int rc;

0 commit comments

Comments
 (0)