[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <51f8a4a6-4fa8-740c-b274-fb521853ef05@virtuozzo.com>
Date: Thu, 15 Nov 2018 09:45:01 +0300
From: Vasily Averin <vvs@...tuozzo.com>
To: linux-kernel@...r.kernel.org,
Christine Caulfield <ccaulfie@...hat.com>,
David Teigland <teigland@...hat.com>, cluster-devel@...hat.com
Subject: [PATCH] dlm: fixed memory leaks after failed ls_remove_names
allocation
If allocation fails on last elements of array need to free already
allocated elements.
Fixes 789924ba635f ("dlm: fix race between remove and lookup")
Cc: stable@...nel.org # 3.6
Signed-off-by: Vasily Averin <vvs@...tuozzo.com>
---
fs/dlm/lockspace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 5ba94be006ee..f99e110a0af8 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -532,7 +532,7 @@ static int new_lockspace(const char *name, const char *cluster,
ls->ls_remove_names[i] = kzalloc(DLM_RESNAME_MAXLEN+1,
GFP_KERNEL);
if (!ls->ls_remove_names[i])
- goto out_rsbtbl;
+ goto out_remove_names;
}
idr_init(&ls->ls_lkbidr);
@@ -680,6 +680,7 @@ static int new_lockspace(const char *name, const char *cluster,
kfree(ls->ls_recover_buf);
out_lkbidr:
idr_destroy(&ls->ls_lkbidr);
+ out_remove_names:
for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
if (ls->ls_remove_names[i])
kfree(ls->ls_remove_names[i]);
--
2.17.1
Powered by blists - more mailing lists