Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp650323imu; Fri, 11 Jan 2019 06:49:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN4pPHIeX+6g0U1fUC2sP3CPjS9IBOI0A026pEEl+dVQH7k103uPag69d/GWPGPteQdz2ET0 X-Received: by 2002:a63:ce50:: with SMTP id r16mr13518997pgi.217.1547218141389; Fri, 11 Jan 2019 06:49:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547218141; cv=none; d=google.com; s=arc-20160816; b=o8HIp7s0lzRFYrqgopdyu3PLho7mq6AmtyGDvicUwcqcu1lXCWuD3bXK9Uxasm+9ZI Wuq5ZWJshfOoEMwJcXLRvUsrJokLjzUIN63EgGqfq0h4fbbwJytrAwkIU/PXT92iweKU QjjOeAQRutLkbG01IG6luhKg7P0YVaN5PcZ0dRhu6kSC+aQffILwZY8iWNYDW1fjtcOj 0/U2ZnWXvrTX4lyX5fgDep5oEXeyIM2KAEaIhts7coNBWCNbnzs0SKsSD8daLkVzWGAJ pnUPUlAlCepCHfeTnacdQltljXmT/5tBC/4jeoaNoWfhA/Ubu3dX3dBeHgPAtXJkYZ9l qCFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AA4uM3LG8y8mes/g5VGHkOEkE6zqkReWWLHMn3KOtTI=; b=Y7IS+WB8+M3GPfuHc+vvVaWua2M7gGTpwYficiTTu17s5SYSi5HgLbxzBsp/JlcgMt Q4lHQnFR6Iq/I1telqX9TBE4aBSYa2LRsHNb54tBu2nVzf5twJp8Ms9yGV7007BkIOyz e2RZUatcHaqHlSO4ipiWB+Fd21YXPLxD5kQG/yVWl0Dvph+giu2eeKQGF8nSbK09CmWu er1XETl6+2SkezMDc5gPjLzxJ16Q8Qy82AzDOPKy+K+pnZZTIlTblk/Y/oK/HRCqUrvM yoBuPznjCzjZ4j60TEDjmKHcfbTuguhpzjOgSRmRtuPf5Sa2D3+JRk3gWM5m95rhagzE U2EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SuWkGciQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si19249629pfa.49.2019.01.11.06.48.46; Fri, 11 Jan 2019 06:49:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SuWkGciQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391478AbfAKOrH (ORCPT + 99 others); Fri, 11 Jan 2019 09:47:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:35394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404196AbfAKOmg (ORCPT ); Fri, 11 Jan 2019 09:42:36 -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 CFD25206B6; Fri, 11 Jan 2019 14:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217756; bh=HRLD5xGJbz0h1fX4Wqpa4yYVAeKwK1SolucJ5rawkLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuWkGciQ/ru2IJ4oxN6bpWruqkV32Qvann9SEPEm4JuUCdUG5u+8D9q+9q9JxPUHR MIGrrUzcugmeqfkPPaxKyISLaPNOM/J8Gsa5jUrMooKiWjpu3UCxC3hXLcOZRKmomm XAKQy9g/73vxKKGE0TjSDAiKsd0H9tVvYncyVZiI= 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.20 29/65] dlm: fixed memory leaks after failed ls_remove_names allocation Date: Fri, 11 Jan 2019 15:15:15 +0100 Message-Id: <20190111131100.317306816@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131055.331350141@linuxfoundation.org> References: <20190111131055.331350141@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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-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)