Commit b982896c authored by Vasily Averin's avatar Vasily Averin Committed by David Teigland

dlm: fixed memory leaks after failed ls_remove_names allocation

If allocation fails on last elements of array need to free already
allocated elements.

v2: just move existing out_rsbtbl label to right place

Fixes 789924ba635f ("dlm: fix race between remove and lookup")
Cc: stable@kernel.org # 3.6
Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 58a923ad
...@@ -680,11 +680,11 @@ static int new_lockspace(const char *name, const char *cluster, ...@@ -680,11 +680,11 @@ static int new_lockspace(const char *name, const char *cluster,
kfree(ls->ls_recover_buf); kfree(ls->ls_recover_buf);
out_lkbidr: out_lkbidr:
idr_destroy(&ls->ls_lkbidr); idr_destroy(&ls->ls_lkbidr);
out_rsbtbl:
for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) { for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
if (ls->ls_remove_names[i]) if (ls->ls_remove_names[i])
kfree(ls->ls_remove_names[i]); kfree(ls->ls_remove_names[i]);
} }
out_rsbtbl:
vfree(ls->ls_rsbtbl); vfree(ls->ls_rsbtbl);
out_lsfree: out_lsfree:
if (do_unreg) if (do_unreg)
......
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