Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp626894imu; Fri, 11 Jan 2019 06:25:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Vx/VfFRxxJ8MFV1H6dgOq1ks1dznwvqrUgPNgSdS/3IJ/1eRMARU41nw4uTQY6IY1nlw+ X-Received: by 2002:a17:902:4324:: with SMTP id i33mr14539933pld.227.1547216742217; Fri, 11 Jan 2019 06:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547216742; cv=none; d=google.com; s=arc-20160816; b=xz84Mlb2rYwntfmYqEzNfHKwvfGmh2QT/Q9IgGSAR0/F1b/N2deS5tvufyrd2RkFAk 505DpsoP08fbE91F88ULjrn6Z8A7lpvrYJ0TfE1Sx3prsamjjb0UO1deqBSOO7de25BG 8q+ixoGi2b6wENFsVlV09sAdDYjFhA2s+s205lE4QF0fYAKOT3aBQw7uVX62izdtMnv/ BmHq5srcxCvMbz/bhv/Bi3+xMk+0XlDlmnq5PxrA7j8+6vmPOoQLCPTdoDjz3VLA7oIS 1bi6iOFwotZ3rc0GeBirW+dN6CwbCQ+aYBK0TrBpTMiN2lPpzVGiZf8A9jKUxchODLQB rM/Q== 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=THRuHywywMYXGNE038acHlmwg73VDZ/dCvgU0RVXRcI=; b=PFtfTWjjzUCcvkD8lpWBwmErdNuJVGs1ZBMGE4E8Y3KIFUTQR4y7storL4aM/EnBTh 5+PIA8dDUQs7xN1IC28HygHJz3rb3sW8R/FG4EFWMoIeq1WflKeUVSfoNJaKTPBtj/Qd ryR8zj7vNmdC4VmUfEj1VIdFoBe7bZOChNPmIjBPOqEmt2PAPdIEe1vtPTEwwO78Enz3 dJ13U++pYF1DZqFPyelIp1UjmWZK5LoSBDR39uhj/l211cCMm/6USu9FxKAm3Fs2kQHx 8LfgFeCE+erdGHIADMpt11931Avhz5Jm1x0oqCVrDhX+zgBhcwLveZagmZ4HEngiLOBm FbqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kW1zZncI; 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 c76si13406511pga.70.2019.01.11.06.25.27; Fri, 11 Jan 2019 06:25:42 -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=kW1zZncI; 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 S1733277AbfAKOTj (ORCPT + 99 others); Fri, 11 Jan 2019 09:19:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:36678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731374AbfAKOTg (ORCPT ); Fri, 11 Jan 2019 09:19: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 7E7262183F; Fri, 11 Jan 2019 14:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216376; bh=38KaG97JDlMjLQlskMuUqZLFVVRlp0t5OEKzsdM1wLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kW1zZncIdpnAQKqdpjp2MP9PY/2dKEKjTzlvEKup7ZqSW58Rqqh1u40yWWRsnPcJZ u5A1X3DJwer7VffZUtwgeqq2B+Y+8QYzmII9c4kfJ+WmnncbApJrjFpypV9PHN0wCX gTsuDneMNYXrEK2F7NhqQCH71Ep0HYNcFCVYno5M= 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.4 76/88] dlm: fixed memory leaks after failed ls_remove_names allocation Date: Fri, 11 Jan 2019 15:08:45 +0100 Message-Id: <20190111131058.647986319@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@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.4-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 @@ -673,11 +673,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)