Commit 0eccdca6 authored by Tycho Andersen's avatar Tycho Andersen Committed by Kleber Sacilotto de Souza

dlm: fix invalid free

BugLink: https://bugs.launchpad.net/bugs/1854855

[ Upstream commit d968b4e2 ]

dlm_config_nodes() does not allocate nodes on failure, so we should not
free() nodes when it fails.
Signed-off-by: default avatarTycho Andersen <tycho@tycho.ws>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 5de7b7cf
...@@ -683,7 +683,7 @@ int dlm_ls_start(struct dlm_ls *ls) ...@@ -683,7 +683,7 @@ int dlm_ls_start(struct dlm_ls *ls)
error = dlm_config_nodes(ls->ls_name, &nodes, &count); error = dlm_config_nodes(ls->ls_name, &nodes, &count);
if (error < 0) if (error < 0)
goto fail; goto fail_rv;
spin_lock(&ls->ls_recover_lock); spin_lock(&ls->ls_recover_lock);
...@@ -715,8 +715,9 @@ int dlm_ls_start(struct dlm_ls *ls) ...@@ -715,8 +715,9 @@ int dlm_ls_start(struct dlm_ls *ls)
return 0; return 0;
fail: fail:
kfree(rv);
kfree(nodes); kfree(nodes);
fail_rv:
kfree(rv);
return error; return error;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment