[Devel] [PATCH RH8 04/10] ms/dlm: fix possible call to kfree() for non-initialized pointer

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Wed May 26 17:56:12 MSK 2021


From: "Denis V. Lunev" <den at openvz.org>

Technically dlm_config_nodes() could return error and keep nodes
uninitialized. After that on the fail path of we'll call kfree()
for that uninitialized value.

The patch is simple - we should just initialize nodes with NULL.

Signed-off-by: Denis V. Lunev <den at openvz.org>
CC: Christine Caulfield <ccaulfie at redhat.com>
CC: David Teigland <teigland at redhat.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
CC: cluster-devel at redhat.com

https://pmc.acronis.com/browse/VSTOR-17522

(cherry-picked from 67d128689daa97c7f34d62409f9bd2256de059ff)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 3fda383..2ce3308 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -671,7 +671,7 @@ int dlm_ls_stop(struct dlm_ls *ls)
 int dlm_ls_start(struct dlm_ls *ls)
 {
 	struct dlm_recover *rv, *rv_old;
-	struct dlm_config_node *nodes;
+	struct dlm_config_node *nodes = NULL;
 	int error, count;
 
 	rv = kzalloc(sizeof(*rv), GFP_NOFS);
-- 
1.8.3.1



More information about the Devel mailing list