Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4199d35c authored by Mimi Zohar's avatar Mimi Zohar
Browse files

vfs: move ima_file_free before releasing the file



ima_file_free(), called on __fput(), currently flags files that have
changed, so that the file is re-measured.  For appraising a files's
integrity, the file's hash must be re-calculated and stored in the
'security.ima' xattr to reflect any changes.

This patch moves the ima_file_free() call to before releasing the file
in preparation of ima-appraisal measuring the file and updating the
'security.ima' xattr.

Signed-off-by: default avatarMimi Zohar <zohar@us.ibm.com>
Acked-by: default avatarSerge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: default avatarDmitry Kasatkin <dmitry.kasatkin@intel.com>
parent 2ab51f37
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -243,10 +243,10 @@ static void __fput(struct file *file)
		if (file->f_op && file->f_op->fasync)
			file->f_op->fasync(-1, file, 0);
	}
	ima_file_free(file);
	if (file->f_op && file->f_op->release)
		file->f_op->release(inode, file);
	security_file_free(file);
	ima_file_free(file);
	if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL &&
		     !(file->f_mode & FMODE_PATH))) {
		cdev_put(inode->i_cdev);