]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dlm: fix possible call to kfree() for non-initialized pointer
authorDenis V. Lunev <den@openvz.org>
Tue, 13 Nov 2018 17:39:50 +0000 (20:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:51:14 +0000 (08:51 +0100)
[ Upstream commit 58a923adf4d9aca8bf7205985c9c8fc531c65d72 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/member.c

index cad6d85911a8021d616acacebb386f44215f44bb..0bc43b35d2c53c66453fd84236812a4fa3439f1f 100644 (file)
@@ -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);