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

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