summaryrefslogtreecommitdiffstats
path: root/security/integrity
diff options
context:
space:
mode:
authorEric Richter <erichte@linux.vnet.ibm.com>2016-10-14 00:47:36 +0200
committerMimi Zohar <zohar@linux.vnet.ibm.com>2016-11-14 04:50:08 +0100
commit9a11a18902bc3b904353063763d06480620245a6 (patch)
tree1884e4b68697ca188f95cb98e0babb6f27def6a5 /security/integrity
parentMerge commit 'v4.9-rc5' into next (diff)
downloadlinux-9a11a18902bc3b904353063763d06480620245a6.tar.xz
linux-9a11a18902bc3b904353063763d06480620245a6.zip
ima: fix memory leak in ima_release_policy
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: 80eae209d63a 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>
Diffstat (limited to 'security/integrity')
-rw-r--r--security/integrity/ima/ima_fs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
index c07a3844ea0a..3df46906492d 100644
--- a/security/integrity/ima/ima_fs.c
+++ b/security/integrity/ima/ima_fs.c
@@ -401,7 +401,7 @@ static int ima_release_policy(struct inode *inode, struct file *file)
const char *cause = valid_policy ? "completed" : "failed";
if ((file->f_flags & O_ACCMODE) == O_RDONLY)
- return 0;
+ return seq_release(inode, file);
if (valid_policy && ima_check_policy() < 0) {
cause = "failed";