From: Vasily Averin Date: Thu, 15 Nov 2018 13:15:05 +0300 Subject: [Cluster-devel] [PATCH v2] dlm: fixed memory leaks after failed ls_remove_names allocation In-Reply-To: <51f8a4a6-4fa8-740c-b274-fb521853ef05@virtuozzo.com> References: <51f8a4a6-4fa8-740c-b274-fb521853ef05@virtuozzo.com> Message-ID: <4214fe38-d4e9-60c9-4555-dd59f4528495@virtuozzo.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 at kernel.org # 3.6 Signed-off-by: Vasily Averin --- fs/dlm/lockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 5ba94be006ee..6a1529e478f3 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -680,11 +680,11 @@ static int new_lockspace(const char *name, const char *cluster, kfree(ls->ls_recover_buf); out_lkbidr: idr_destroy(&ls->ls_lkbidr); + out_rsbtbl: for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) { if (ls->ls_remove_names[i]) kfree(ls->ls_remove_names[i]); } - out_rsbtbl: vfree(ls->ls_rsbtbl); out_lsfree: if (do_unreg) -- 2.17.1