]>
Commit | Line | Data |
---|---|---|
341e731e GKH |
1 | From b982896cdb6e6a6b89d86dfb39df489d9df51e14 Mon Sep 17 00:00:00 2001 |
2 | From: Vasily Averin <vvs@virtuozzo.com> | |
3 | Date: Thu, 15 Nov 2018 13:15:05 +0300 | |
4 | Subject: dlm: fixed memory leaks after failed ls_remove_names allocation | |
5 | ||
6 | From: Vasily Averin <vvs@virtuozzo.com> | |
7 | ||
8 | commit b982896cdb6e6a6b89d86dfb39df489d9df51e14 upstream. | |
9 | ||
10 | If allocation fails on last elements of array need to free already | |
11 | allocated elements. | |
12 | ||
13 | v2: just move existing out_rsbtbl label to right place | |
14 | ||
15 | Fixes 789924ba635f ("dlm: fix race between remove and lookup") | |
16 | Cc: stable@kernel.org # 3.6 | |
17 | ||
18 | Signed-off-by: Vasily Averin <vvs@virtuozzo.com> | |
19 | Signed-off-by: David Teigland <teigland@redhat.com> | |
20 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | ||
22 | --- | |
23 | fs/dlm/lockspace.c | 2 +- | |
24 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
25 | ||
26 | --- a/fs/dlm/lockspace.c | |
27 | +++ b/fs/dlm/lockspace.c | |
28 | @@ -673,11 +673,11 @@ static int new_lockspace(const char *nam | |
29 | kfree(ls->ls_recover_buf); | |
30 | out_lkbidr: | |
31 | idr_destroy(&ls->ls_lkbidr); | |
32 | + out_rsbtbl: | |
33 | for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) { | |
34 | if (ls->ls_remove_names[i]) | |
35 | kfree(ls->ls_remove_names[i]); | |
36 | } | |
37 | - out_rsbtbl: | |
38 | vfree(ls->ls_rsbtbl); | |
39 | out_lsfree: | |
40 | if (do_unreg) |