Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp767052ybc; Sat, 16 Nov 2019 08:19:50 -0800 (PST) X-Google-Smtp-Source: APXvYqwqvui9OBy17hUyXOjSDGWpPUzEW2AYBcw+5gDyRtsoaNyu1zYuDXNHJ8YfBxaUV2f7xVNN X-Received: by 2002:a17:906:1a47:: with SMTP id j7mr10808088ejf.232.1573921190158; Sat, 16 Nov 2019 08:19:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921190; cv=none; d=google.com; s=arc-20160816; b=UNyx/5asuuoAwmZPPSDFPGip1N+D4P5xtgPFSgtWnI2/nfvU5f0RjYODfzuozILRC7 FQd25QCqEsm5dViF8AoZSMP8Ytkj+4vgrh9sPwCwxsXiD+lIQUO4l+hBX33lyANNHTP5 /+sf2GfYIEckvrDJ8B7rE0mT2T0ngxj4LcB3JqMa3bhXuUclzwr5jRZ0ofevqziq3a1T Z7BzTlHpnumempnR+aHgM8nvAftYTeWwR5X8x0y0lng9Xm7cotu3bWOQxoH8CgRJf3Pk 0btE5G8T7/FriSSiGIMSJ8yawlLVXeB/VbjI7+7ygF3eWLbRNYtBKxH5dusBSofeeKTl 7EqA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3L2uo7XqjMqqstdpGnygmE/vrV95hGnvTXYhdGdD5LI=; b=Xi+W7Tx3bYsFmGUl0FxD9Kp3bHnTWg1hsU5Eq4/AWxk5qNMqZ+qU8DkaUj8+o095G3 NNVie1+a/ECimcFEwv3pw3lf+gup6pZ3JBCuwx4FDMXfELn1Tc88ozzepyXdUlvgqWlt L0UTEPkhQ/8jbXKKij87fJCfoPoufmz2+7D0H5BXBzhsHzsCup2R4/Vat0IaqE4PFZjz c21+LsIsvpYXABqgaX1ldFuddwZ5dZV3xqmcHawP4lEzyYXi4uAW37JPMyf3swqT9FIp sR65TSAPvWxJI7zrpEbAcA/XMNCUFI+OthAis9fqER0AdrHIVrvl5sj2NPoOo/mPryqS WDsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XdENUrGH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si8480745edb.439.2019.11.16.08.19.24; Sat, 16 Nov 2019 08:19:50 -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=XdENUrGH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731978AbfKPQRG (ORCPT + 99 others); Sat, 16 Nov 2019 11:17:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:53426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729529AbfKPPqv (ORCPT ); Sat, 16 Nov 2019 10:46:51 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8070D208C0; Sat, 16 Nov 2019 15:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919210; bh=H0+p4fK298kw1jSTheIrFbd+g0vAAzU0oZwSoqofGG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XdENUrGHqSrZiq5thoCAMtMODLcrsfkIDL0xl15EjpieagEL1pKtlyCES+FxcJJ+9 yvp1ai5Hpg3PKz+XRODHuMFN7TuqRuMZ3nRlWSc+nP74nma7oLj10k7za5JvLywoiw ZmYdMBOBXbt0KejdkKofJUkqieSXPmPSvwxCqRjY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tycho Andersen , David Teigland , Sasha Levin , cluster-devel@redhat.com Subject: [PATCH AUTOSEL 4.19 216/237] dlm: fix invalid free Date: Sat, 16 Nov 2019 10:40:51 -0500 Message-Id: <20191116154113.7417-216-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tycho Andersen [ Upstream commit d968b4e240cfe39d39d80483bac8bca8716fd93c ] dlm_config_nodes() does not allocate nodes on failure, so we should not free() nodes when it fails. Signed-off-by: Tycho Andersen Signed-off-by: David Teigland Signed-off-by: Sasha Levin --- fs/dlm/member.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/dlm/member.c b/fs/dlm/member.c index 3fda3832cf6a6..cad6d85911a80 100644 --- a/fs/dlm/member.c +++ b/fs/dlm/member.c @@ -680,7 +680,7 @@ int dlm_ls_start(struct dlm_ls *ls) error = dlm_config_nodes(ls->ls_name, &nodes, &count); if (error < 0) - goto fail; + goto fail_rv; spin_lock(&ls->ls_recover_lock); @@ -712,8 +712,9 @@ int dlm_ls_start(struct dlm_ls *ls) return 0; fail: - kfree(rv); kfree(nodes); + fail_rv: + kfree(rv); return error; } -- 2.20.1