Skip to content

Commit 2e3a34e

Browse files
robertosassumimizohar
authored andcommitted
ima: Fix return value of ima_write_policy()
This patch fixes the return value of ima_write_policy() when a new policy is directly passed to IMA and the current policy requires appraisal of the file containing the policy. Currently, if appraisal is not in ENFORCE mode, ima_write_policy() returns 0 and leads user space applications to an endless loop. Fix this issue by denying the operation regardless of the appraisal mode. Cc: [email protected] # 4.10.x Fixes: 19f8a84 ("ima: measure and appraise the IMA policy itself") Signed-off-by: Roberto Sassu <[email protected]> Reviewed-by: Krzysztof Struczynski <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent 53de3b0 commit 2e3a34e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

security/integrity/ima/ima_fs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,
338338
integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL,
339339
"policy_update", "signed policy required",
340340
1, 0);
341-
if (ima_appraise & IMA_APPRAISE_ENFORCE)
342-
result = -EACCES;
341+
result = -EACCES;
343342
} else {
344343
result = ima_parse_add_rule(data);
345344
}

0 commit comments

Comments
 (0)