linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ima: Free IMA measurement buffer on error
@ 2021-02-04 17:49 Lakshmi Ramasubramanian
  2021-02-04 17:49 ` [PATCH v2 2/2] ima: Free IMA measurement buffer after kexec syscall Lakshmi Ramasubramanian
  2021-02-05 10:05 ` [PATCH v2 1/2] ima: Free IMA measurement buffer on error Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Lakshmi Ramasubramanian @ 2021-02-04 17:49 UTC (permalink / raw)
  To: zohar, bauerman, dmitry.kasatkin, ebiederm, gregkh, sashal, tyhicks
  Cc: linux-integrity, linuxppc-dev, linux-kernel

IMA allocates kernel virtual memory to carry forward the measurement
list, from the current kernel to the next kernel on kexec system call,
in ima_add_kexec_buffer() function.  In error code paths this memory
is not freed resulting in memory leak.

Free the memory allocated for the IMA measurement list in
the error code paths in ima_add_kexec_buffer() function.

Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Suggested-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Fixes: 7b8589cc29e7 ("ima: on soft reboot, save the measurement list")
---
 security/integrity/ima/ima_kexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c
index 121de3e04af2..206ddcaa5c67 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -119,6 +119,7 @@ void ima_add_kexec_buffer(struct kimage *image)
 	ret = kexec_add_buffer(&kbuf);
 	if (ret) {
 		pr_err("Error passing over kexec measurement buffer.\n");
+		vfree(kexec_buffer);
 		return;
 	}
 
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-23 23:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 17:49 [PATCH v2 1/2] ima: Free IMA measurement buffer on error Lakshmi Ramasubramanian
2021-02-04 17:49 ` [PATCH v2 2/2] ima: Free IMA measurement buffer after kexec syscall Lakshmi Ramasubramanian
2021-02-05 10:05   ` Greg KH
2021-02-05 10:05 ` [PATCH v2 1/2] ima: Free IMA measurement buffer on error Greg KH
2021-02-05 17:39   ` Lakshmi Ramasubramanian
2021-02-05 17:49     ` Mimi Zohar
2021-02-05 17:59       ` Lakshmi Ramasubramanian
2021-02-23 23:33         ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).