ima: Align ima_inode_removexattr() definition with LSM infrastructure

Change ima_inode_removexattr() definition, so that it can be registered as
implementation of the inode_removexattr hook.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Acked-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
Roberto Sassu 2024-02-15 11:30:52 +01:00 committed by Paul Moore
parent fbd0506e5c
commit 526864dd2f
3 changed files with 8 additions and 4 deletions

View File

@ -200,7 +200,9 @@ static inline int ima_inode_remove_acl(struct mnt_idmap *idmap,
{ {
return ima_inode_set_acl(idmap, dentry, acl_name, NULL); return ima_inode_set_acl(idmap, dentry, acl_name, NULL);
} }
extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
extern int ima_inode_removexattr(struct mnt_idmap *idmap, struct dentry *dentry,
const char *xattr_name);
#else #else
static inline bool is_ima_appraise_enabled(void) static inline bool is_ima_appraise_enabled(void)
{ {
@ -231,7 +233,8 @@ static inline int ima_inode_set_acl(struct mnt_idmap *idmap,
return 0; return 0;
} }
static inline int ima_inode_removexattr(struct dentry *dentry, static inline int ima_inode_removexattr(struct mnt_idmap *idmap,
struct dentry *dentry,
const char *xattr_name) const char *xattr_name)
{ {
return 0; return 0;

View File

@ -790,7 +790,8 @@ int ima_inode_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
return 0; return 0;
} }
int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name) int ima_inode_removexattr(struct mnt_idmap *idmap, struct dentry *dentry,
const char *xattr_name)
{ {
int result; int result;

View File

@ -2430,7 +2430,7 @@ int security_inode_removexattr(struct mnt_idmap *idmap,
ret = cap_inode_removexattr(idmap, dentry, name); ret = cap_inode_removexattr(idmap, dentry, name);
if (ret) if (ret)
return ret; return ret;
ret = ima_inode_removexattr(dentry, name); ret = ima_inode_removexattr(idmap, dentry, name);
if (ret) if (ret)
return ret; return ret;
return evm_inode_removexattr(idmap, dentry, name); return evm_inode_removexattr(idmap, dentry, name);