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

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 1 20:29:50 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.34
------>
commit ed7c9f412e54c6351a53f273c4b450e9636b2e82
Author: Denis V. Lunev <den at openvz.org>
Date:   Tue Jun 1 20:29:50 2021 +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 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 vz7 commit 67d128689daa97c7f34d62409f9bd2256de059ff)
    ms commit: 58a923adf4d9 ("dlm: fix possible call to kfree() for non-initialized
    pointer")
    
    Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 fs/dlm/member.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 3fda3832cf6a..2ce33088f8bb 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);


More information about the Devel mailing list