[RHEL7,COMMIT] ms/dlm: fix possible call to kfree() for non-initialized pointer

Submitted by Konstantin Khorenko on Nov. 15, 2018, 9:46 a.m.

Details

Message ID 201811150946.wAF9kf1K006483@finist-ce7.sw.ru
State New
Series "ms/dlm: fix possible call to kfree() for non-initialized pointer"
Headers show

Commit Message

Konstantin Khorenko Nov. 15, 2018, 9:46 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.20.2.vz7.73.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.20.2.vz7.73.5
------>
commit 67d128689daa97c7f34d62409f9bd2256de059ff
Author: Denis V. Lunev <den@openvz.org>
Date:   Tue Nov 13 20:42:43 2018 +0300

    ms/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.
    
    Signed-off-by: Denis V. Lunev <den@openvz.org>
    CC: Christine Caulfield <ccaulfie@redhat.com>
    CC: David Teigland <teigland@redhat.com>
    CC: Konstantin Khorenko <khorenko@virtuozzo.com>
    CC: cluster-devel@redhat.com
    
    https://pmc.acronis.com/browse/VSTOR-17522
---
 fs/dlm/member.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 476557b54921..332f53664972 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -677,7 +677,7 @@  int dlm_ls_stop(struct dlm_ls *ls)
 int dlm_ls_start(struct dlm_ls *ls)
 {
 	struct dlm_recover *rv = NULL, *rv_old;
-	struct dlm_config_node *nodes;
+	struct dlm_config_node *nodes = NULL;
 	int error, count;
 
 	rv = kzalloc(sizeof(struct dlm_recover), GFP_NOFS);