dlm: fix invalid free
authorTycho Andersen <tycho@tycho.ws>
Fri, 2 Nov 2018 20:18:20 +0000 (14:18 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Nov 2019 17:29:00 +0000 (18:29 +0100)
[ Upstream commit d968b4e240cfe39d39d80483bac8bca8716fd93c ]

dlm_config_nodes() does not allocate nodes on failure, so we should not
free() nodes when it fails.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/member.c

index 9c47f1c14a8badb59048a88cf33b674e93a679e4..a47ae99f7bcbcf91f54123d62ea3ba4beb864baf 100644 (file)
@@ -683,7 +683,7 @@ int dlm_ls_start(struct dlm_ls *ls)
 
        error = dlm_config_nodes(ls->ls_name, &nodes, &count);
        if (error < 0)
-               goto fail;
+               goto fail_rv;
 
        spin_lock(&ls->ls_recover_lock);
 
@@ -715,8 +715,9 @@ int dlm_ls_start(struct dlm_ls *ls)
        return 0;
 
  fail:
-       kfree(rv);
        kfree(nodes);
+ fail_rv:
+       kfree(rv);
        return error;
 }