Blob Blame History Raw
From 58a923adf4d9aca8bf7205985c9c8fc531c65d72 Mon Sep 17 00:00:00 2001
From: "Denis V. Lunev" <den@openvz.org>
Date: Tue, 13 Nov 2018 20:39:50 +0300
Subject: [PATCH] dlm: fix possible call to kfree() for non-initialized pointer
Git-commit: 58a923adf4d9aca8bf7205985c9c8fc531c65d72
Patch-mainline: v5.0-rc1
References: git-fixes

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@openvz.org>
Signed-off-by: David Teigland <teigland@redhat.com>
Acked-by: Anthony Iliopoulos <ailiop@suse.com>

---
 fs/dlm/member.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -674,7 +674,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(struct dlm_recover), GFP_NOFS);