summaryrefslogtreecommitdiff
path: root/security/integrity/ima/ima_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/integrity/ima/ima_main.c')
-rw-r--r--security/integrity/ima/ima_main.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 60dd61527b1e..203de979d305 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -112,22 +112,23 @@ void ima_counts_get(struct file *file)
if (!ima_initialized)
goto out;
- rc = ima_must_measure(NULL, inode, MAY_READ, FILE_CHECK);
- if (rc < 0)
- goto out;
-
if (mode & FMODE_WRITE) {
- if (inode->i_readcount)
+ if (inode->i_readcount && IS_IMA(inode))
send_tomtou = true;
goto out;
}
+ rc = ima_must_measure(NULL, inode, MAY_READ, FILE_CHECK);
+ if (rc < 0)
+ goto out;
+
if (atomic_read(&inode->i_writecount) > 0)
send_writers = true;
out:
/* remember the vfs deals with i_writecount */
if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
inode->i_readcount++;
+
spin_unlock(&inode->i_lock);
if (send_tomtou)