Skip to content

Commit

Permalink
ima: don't remove the securityfs policy file
Browse files Browse the repository at this point in the history
The securityfs policy file is removed unless additional rules can be
appended to the IMA policy (CONFIG_IMA_WRITE_POLICY), regardless as
to whether the policy is configured so that it can be displayed.

This patch changes this behavior, removing the securityfs policy file,
only if CONFIG_IMA_READ_POLICY is also not enabled.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
  • Loading branch information
Mimi Zohar committed Nov 8, 2017
1 parent 46cdc6d commit 2068626
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/integrity/ima/ima_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ static int ima_release_policy(struct inode *inode, struct file *file)
}

ima_update_policy();
#ifndef CONFIG_IMA_WRITE_POLICY
#if !defined(CONFIG_IMA_WRITE_POLICY) && !defined(CONFIG_IMA_READ_POLICY)
securityfs_remove(ima_policy);
ima_policy = NULL;
#else
#elif defined(CONFIG_IMA_WRITE_POLICY)
clear_bit(IMA_FS_BUSY, &ima_fs_flags);
#endif
return 0;
Expand Down

0 comments on commit 2068626

Please sign in to comment.