Skip to content

Commit

Permalink
evm: Don't return an error in evm_write_xattrs() if audit is not enabled
Browse files Browse the repository at this point in the history
This patch avoids that evm_write_xattrs() returns an error when audit is
not enabled. The ab variable can be NULL and still be passed to the other
audit_log_() functions, as those functions do not include any instruction.

Signed-off-by: Roberto Sassu <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
  • Loading branch information
robertosassu authored and mimizohar committed Jun 3, 2021
1 parent 88016de commit d721c15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/integrity/evm/evm_secfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,

ab = audit_log_start(audit_context(), GFP_KERNEL,
AUDIT_INTEGRITY_EVM_XATTR);
if (!ab)
if (!ab && IS_ENABLED(CONFIG_AUDIT))
return -ENOMEM;

xattr = kmalloc(sizeof(struct xattr_list), GFP_KERNEL);
Expand Down

0 comments on commit d721c15

Please sign in to comment.