Blame SOURCES/0009-ecryptfs-fix-a-memory-leak-bug-in-ecryptfs_init_mess.patch

Kmods SIG c540c3
From b4a81b87a4cfe2bb26a4a943b748d96a43ef20e8 Mon Sep 17 00:00:00 2001
Kmods SIG c540c3
From: Wenwen Wang <wenwen@cs.uga.edu>
Kmods SIG c540c3
Date: Tue, 20 Aug 2019 00:33:54 -0500
Kmods SIG c540c3
Subject: [Backport b4a81b87a4cf] ecryptfs: fix a memory leak bug in
Kmods SIG c540c3
 ecryptfs_init_messaging()
Kmods SIG c540c3
Kmods SIG c540c3
In ecryptfs_init_messaging(), if the allocation for 'ecryptfs_msg_ctx_arr'
Kmods SIG c540c3
fails, the previously allocated 'ecryptfs_daemon_hash' is not deallocated,
Kmods SIG c540c3
leading to a memory leak bug. To fix this issue, free
Kmods SIG c540c3
'ecryptfs_daemon_hash' before returning the error.
Kmods SIG c540c3
Kmods SIG c540c3
Cc: stable@vger.kernel.org
Kmods SIG c540c3
Fixes: 88b4a07e6610 ("[PATCH] eCryptfs: Public key transport mechanism")
Kmods SIG c540c3
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Kmods SIG c540c3
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Kmods SIG c540c3
---
Kmods SIG c540c3
 src/messaging.c | 1 +
Kmods SIG c540c3
 1 file changed, 1 insertion(+)
Kmods SIG c540c3
Kmods SIG c540c3
diff --git a/src/messaging.c b/src/messaging.c
Kmods SIG c540c3
index d668e60b85b556dd27b08a345a222688b795257c..c05ca39aa4494f9077768fc9e04b21d817a3401b 100644
Kmods SIG c540c3
--- a/src/messaging.c
Kmods SIG c540c3
+++ b/src/messaging.c
Kmods SIG c540c3
@@ -379,6 +379,7 @@ int __init ecryptfs_init_messaging(void)
Kmods SIG c540c3
 					* ecryptfs_message_buf_len),
Kmods SIG c540c3
 				       GFP_KERNEL);
Kmods SIG c540c3
 	if (!ecryptfs_msg_ctx_arr) {
Kmods SIG c540c3
+		kfree(ecryptfs_daemon_hash);
Kmods SIG c540c3
 		rc = -ENOMEM;
Kmods SIG c540c3
 		goto out;
Kmods SIG c540c3
 	}
Kmods SIG c540c3
-- 
Kmods SIG c540c3
2.31.1
Kmods SIG c540c3