Skip to content

Commit 825e6a0

Browse files
Eric Richtergregkh
authored andcommitted
ima: fix memory leak in ima_release_policy
commit 9a11a18 upstream. When the "policy" securityfs file is opened for read, it is opened as a sequential file. However, when it is eventually released, there is no cleanup for the sequential file, therefore some memory is leaked. This patch adds a call to seq_release() in ima_release_policy() to clean up the memory when the file is opened for read. Fixes: 80eae20 IMA: allow reading back the current policy Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Eric Richter <erichte@linux.vnet.ibm.com> Tested-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c4c11b4 commit 825e6a0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎security/integrity/ima/ima_fs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int ima_release_policy(struct inode *inode, struct file *file)
401401
const char *cause = valid_policy ? "completed" : "failed";
402402

403403
if ((file->f_flags & O_ACCMODE) == O_RDONLY)
404-
return 0;
404+
return seq_release(inode, file);
405405

406406
if (valid_policy && ima_check_policy() < 0) {
407407
cause = "failed";

0 commit comments

Comments
 (0)