Skip to content

Commit fbd0506

Browse files
robertosassupcmoore
authored andcommitted
ima: Align ima_inode_setxattr() definition with LSM infrastructure
Change ima_inode_setxattr() definition, so that it can be registered as implementation of the inode_setxattr hook. Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com> Reviewed-by: Casey Schaufler <casey@schaufler-ca.com> Acked-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 0298c5a commit fbd0506

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

include/linux/ima.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,9 @@ static inline void ima_post_key_create_or_update(struct key *keyring,
188188
extern bool is_ima_appraise_enabled(void);
189189
extern void ima_inode_post_setattr(struct mnt_idmap *idmap,
190190
struct dentry *dentry, int ia_valid);
191-
extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
192-
const void *xattr_value, size_t xattr_value_len);
191+
extern int ima_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
192+
const char *xattr_name, const void *xattr_value,
193+
size_t xattr_value_len, int flags);
193194
extern int ima_inode_set_acl(struct mnt_idmap *idmap,
194195
struct dentry *dentry, const char *acl_name,
195196
struct posix_acl *kacl);
@@ -212,10 +213,12 @@ static inline void ima_inode_post_setattr(struct mnt_idmap *idmap,
212213
return;
213214
}
214215

215-
static inline int ima_inode_setxattr(struct dentry *dentry,
216+
static inline int ima_inode_setxattr(struct mnt_idmap *idmap,
217+
struct dentry *dentry,
216218
const char *xattr_name,
217219
const void *xattr_value,
218-
size_t xattr_value_len)
220+
size_t xattr_value_len,
221+
int flags)
219222
{
220223
return 0;
221224
}

security/integrity/ima/ima_appraise.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,9 @@ static int validate_hash_algo(struct dentry *dentry,
750750
return -EACCES;
751751
}
752752

753-
int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
754-
const void *xattr_value, size_t xattr_value_len)
753+
int ima_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
754+
const char *xattr_name, const void *xattr_value,
755+
size_t xattr_value_len, int flags)
755756
{
756757
const struct evm_ima_xattr_data *xvalue = xattr_value;
757758
int digsig = 0;

security/security.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,7 @@ int security_inode_setxattr(struct mnt_idmap *idmap,
22692269
ret = cap_inode_setxattr(dentry, name, value, size, flags);
22702270
if (ret)
22712271
return ret;
2272-
ret = ima_inode_setxattr(dentry, name, value, size);
2272+
ret = ima_inode_setxattr(idmap, dentry, name, value, size, flags);
22732273
if (ret)
22742274
return ret;
22752275
return evm_inode_setxattr(idmap, dentry, name, value, size);

0 commit comments

Comments
 (0)