Skip to contentSkip to conversation

dlm: fix possible call to kfree() for non-initialized pointer

PATCH New Denis V. Lunev 1 participant 1 message Nov 13, 2018 Distributed lock manager (DLM)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dlm: fix possible call to kfree() for non-initialized pointer

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.

CC Christine Caulfield <[email protected]>
CC David Teigland <[email protected]>
CC Konstantin Khorenko <[email protected]>
---
 fs/dlm/member.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/member.c +1 -1
index 3fda3832cf6a..2ce33088f8bb 100644
@@ -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);
Signature · 1 line
2.17.1