[4/5] integrity: measure the file on sync
diff mbox series

Message ID 20190513125354.23126-5-janne.karhunen@gmail.com
State New
Headers show
  • integrity: improve ima measurement accuracy
Related show

Commit Message

Janne Karhunen May 13, 2019, 12:53 p.m. UTC
When user requests a file sync, make sure that the IMA
measurement reflects the state of the data being sync'd.

Depends on commit c8213962517e ("integrity: keep the integrity state of open files up to date")'

Signed-off-by: Janne Karhunen <janne.karhunen@gmail.com>
Signed-off-by: Konsta Karsisto <konsta.karsisto@gmail.com>
 fs/sync.c | 3 +++
 1 file changed, 3 insertions(+)

diff mbox series

diff --git a/fs/sync.c b/fs/sync.c
index b54e0541ad89..90353f9ed931 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -16,6 +16,7 @@ 
 #include <linux/pagemap.h>
 #include <linux/quotaops.h>
 #include <linux/backing-dev.h>
+#include <linux/ima.h>
 #include "internal.h"
@@ -194,6 +195,8 @@  int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync)
 		return -EINVAL;
 	if (!datasync && (inode->i_state & I_DIRTY_TIME))
+	ima_file_update(file);
 	return file->f_op->fsync(file, start, end, datasync);