]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.132/dlm-fixed-memory-leaks-after-failed-ls_remove_names-allocation.patch
Linux 4.4.177
[thirdparty/kernel/stable-queue.git] / releases / 3.18.132 / dlm-fixed-memory-leaks-after-failed-ls_remove_names-allocation.patch
CommitLineData
341e731e
GKH
1From b982896cdb6e6a6b89d86dfb39df489d9df51e14 Mon Sep 17 00:00:00 2001
2From: Vasily Averin <vvs@virtuozzo.com>
3Date: Thu, 15 Nov 2018 13:15:05 +0300
4Subject: dlm: fixed memory leaks after failed ls_remove_names allocation
5
6From: Vasily Averin <vvs@virtuozzo.com>
7
8commit b982896cdb6e6a6b89d86dfb39df489d9df51e14 upstream.
9
10If allocation fails on last elements of array need to free already
11allocated elements.
12
13v2: just move existing out_rsbtbl label to right place
14
15Fixes 789924ba635f ("dlm: fix race between remove and lookup")
16Cc: stable@kernel.org # 3.6
17
18Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
19Signed-off-by: David Teigland <teigland@redhat.com>
20Signed-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)