Skip to content

Commit

Permalink
IMA: switch IMA over to new i_version API
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Layton <[email protected]>
  • Loading branch information
jtlayton committed Jan 29, 2018
1 parent f0e2828 commit 3b370b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion security/integrity/ima/ima_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/fs.h>
#include <linux/xattr.h>
#include <linux/evm.h>
#include <linux/iversion.h>

#include "ima.h"

Expand Down Expand Up @@ -215,7 +216,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint,
* which do not support i_version, support is limited to an initial
* measurement/appraisal/audit.
*/
i_version = file_inode(file)->i_version;
i_version = inode_query_iversion(inode);
hash.hdr.algo = algo;

/* Initialize hash digest to 0's in case of failure */
Expand Down
3 changes: 2 additions & 1 deletion security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/xattr.h>
#include <linux/ima.h>
#include <linux/iversion.h>

#include "ima.h"

Expand Down Expand Up @@ -128,7 +129,7 @@ static void ima_check_last_writer(struct integrity_iint_cache *iint,
inode_lock(inode);
if (atomic_read(&inode->i_writecount) == 1) {
if (!IS_I_VERSION(inode) ||
(iint->version != inode->i_version) ||
inode_cmp_iversion(inode, iint->version) ||
(iint->flags & IMA_NEW_FILE)) {
iint->flags &= ~(IMA_DONE_MASK | IMA_NEW_FILE);
iint->measured_pcrs = 0;
Expand Down

0 comments on commit 3b370b2

Please sign in to comment.