Skip to contentSkip to conversation

Patch "ima: fix memory leak in ima_release_policy" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 9, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ima: fix memory leak in ima_release_policy

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ima-fix-memory-leak-in-ima_release_policy.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 9a11a18902bc3b904353063763d06480620245a6 Mon Sep 17 00:00:00 2001

From: Eric Richter <[email protected]>
Date: Thu, 13 Oct 2016 17:47:36 -0500
Subject: ima: fix memory leak in ima_release_policy

From: Eric Richter <[email protected]>

commit 9a11a18902bc3b904353063763d06480620245a6 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 80eae209d63a IMA: allow reading back the current policy
---
 security/integrity/ima/ima_fs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_fs.c +1 -1
@@ -401,7 +401,7 @@ static int ima_release_policy(struct ino
 	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";

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/ima-fix-memory-leak-in-ima_release_policy.patch