Skip to content

Commit

Permalink
ima: without an IMA policy loaded, return quickly
Browse files Browse the repository at this point in the history
Unless an IMA policy is loaded, don't bother checking for an appraise
policy rule.  Return immediately.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
  • Loading branch information
mimizohar committed Mar 22, 2021
1 parent 92063f3 commit f873b28
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ void ima_post_create_tmpfile(struct user_namespace *mnt_userns,
struct integrity_iint_cache *iint;
int must_appraise;

if (!ima_policy_flag || !S_ISREG(inode->i_mode))
return;

must_appraise = ima_must_appraise(mnt_userns, inode, MAY_ACCESS,
FILE_CHECK);
if (!must_appraise)
Expand Down Expand Up @@ -636,6 +639,9 @@ void ima_post_path_mknod(struct user_namespace *mnt_userns,
struct inode *inode = dentry->d_inode;
int must_appraise;

if (!ima_policy_flag || !S_ISREG(inode->i_mode))
return;

must_appraise = ima_must_appraise(mnt_userns, inode, MAY_ACCESS,
FILE_CHECK);
if (!must_appraise)
Expand Down

0 comments on commit f873b28

Please sign in to comment.