From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C034C43387 for ; Fri, 11 Jan 2019 14:59:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D87862133F for ; Fri, 11 Jan 2019 14:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547218777; bh=yUaub11QHYhPmz5chVvkaZDQ1OVh6Ce+RL12oQWuIMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BNIsY7NKYxEhmL0S9UEdQgI456wk4MLp3nUOWYj3fCZA5u34r3SpBrIMiU6VIPdAj pSyc6Dg1K6rcAN8VwLMHyvb65I9BMAr2zvjr6j7qk5dFBHgFD19ABqLLe7F45ETZOG AD2GTeeKsatyI3LxP9ylgUBBMLnnWESppKfRa/iE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388841AbfAKOdf (ORCPT ); Fri, 11 Jan 2019 09:33:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:53788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389641AbfAKOde (ORCPT ); Fri, 11 Jan 2019 09:33:34 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E4A522133F; Fri, 11 Jan 2019 14:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217213; bh=yUaub11QHYhPmz5chVvkaZDQ1OVh6Ce+RL12oQWuIMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jehXyESPsQU6BU9rISossdT2WsMhgj8TLAfQu8jV4NYcU5mq88RrwowPNkvo0XKFd DbKp3M6PAH5CQuXTrcnQV+kKrvQFY4BeWVFQo4ozxbOblsQuuJzaahZNqD25gAGuEk u+UNwBswT6p5ufcBhERJ8AneaowQCfIXmsckFWok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , David Teigland , stable@kernel.org Subject: [PATCH 4.14 084/105] dlm: fixed memory leaks after failed ls_remove_names allocation Date: Fri, 11 Jan 2019 15:14:55 +0100 Message-Id: <20190111131110.007932844@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131102.899065735@linuxfoundation.org> References: <20190111131102.899065735@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin commit b982896cdb6e6a6b89d86dfb39df489d9df51e14 upstream. 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: Vasily Averin Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/lockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -680,11 +680,11 @@ static int new_lockspace(const char *nam 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)