@@ -3418,8 +3418,11 @@ static int do_last(struct nameidata *nd,
goto out;
opened:
error = ima_file_check(file, op->acc_mode);
- if (!error && will_truncate)
+ if (!error && will_truncate) {
error = handle_truncate(file);
+ if (!error)
+ ima_file_update(file);
+ }
out:
if (unlikely(error > 0)) {
WARN_ON(1);
@@ -62,6 +62,9 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
/* Note any delegations or leases have already been broken: */
ret = notify_change(dentry, &newattrs, NULL);
inode_unlock(dentry->d_inode);
+
+ if (filp)
+ ima_file_update(filp);
return ret;
}