Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp851414pxk; Thu, 17 Sep 2020 19:03:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEeG3ak2LaC0Ta6C90mcv4tsHaYTSTrK+WerVlwLWndbdc4fxlPzme2K4L5LvG28DJCl+f X-Received: by 2002:aa7:db02:: with SMTP id t2mr35737708eds.95.1600394628685; Thu, 17 Sep 2020 19:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394628; cv=none; d=google.com; s=arc-20160816; b=N5m3w5+VPq5DAP+NITKe5GPQcoRxEAT8uHqJF1077G9M/k3sM9N+kNtUR8+H7fZhO7 /w+oRg3bWTitWlRZ0ocS3EYtwM5wGHQFE0AAxRrIF6sDMkuLcNhgqdLIsMK0BTuuUWfT kMjkQmPskF3bfk1ie+9DSDUnHcOpfWFBoJRjmWPNNcrQRwvw89Y/UcXXJ/9WwZp9Q4Mg PmTjz86LDWa1bqwtx8rOWBF4bfFO3jnLfQCWlqtF2EwmmD4pZC2FI1DbApW+65Bla2s7 S0IiApCzW4pJ0AKJytbfqqedkQ18fkg1lrng91k5u7d6T/XeAFqCR3Vp9ZgF/x9Lr3fP 72QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t+X3Mws94zqzJUe1r2joY+CAu7+tcWaiolvh5R61vS4=; b=BBH2AuF5SforbnG2HojgGdxnY0fwtAItdPjVzF6dCOKyz/RCAhkcxZO93mKNWvNpDz imCusVv+5Ay2HKYwMnnr38OVU/8O04tMZ1q+OhNe650Qka8uQuiwXfXl7TXaJmaT7t9c eNqpjbGEMaI+jNTX756sVn4yNlsbmdQnSZPZprlnisOcHxgRfcEjFDO/EgLm1g7uktpC 58tdUGWr6lgZEdolQMPszTVt+Lda9wUcjkina3ZnZLVbDEJ/5sbDOX6mcbf+2HWNC5PX nuh2AiUUdK2/dnXey/CEdPNdkWbT6OB5H7SluoaV8cJh4r+qzBUxWplLfdVoHyIkJvuZ Oa0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fIyIJzQ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id t15si1085425edr.122.2020.09.17.19.03.25; Thu, 17 Sep 2020 19:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fIyIJzQ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726599AbgIRCB7 (ORCPT + 99 others); Thu, 17 Sep 2020 22:01:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgIRCB4 (ORCPT ); Thu, 17 Sep 2020 22:01:56 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 630A321734; Fri, 18 Sep 2020 02:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394516; bh=hUeHE+59BPSZBYX15nEVEG9KNRYhI3yfLK/6Y4HSMjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fIyIJzQ5D6WHpSk9Gb9dAuxvLERUv/XijKxFKWc+GAP+QZdSQXCDYTrkwdU98l78V kCnWDLaF7uNXF86sWa4yiFt4i3X0OqH7SFVzIWrL1WK75aQ6hT0IUZg+3OKy7BVAQq JXyIQFmwhLjV91Z+AfvUglwku5Lty8rVrqVi1psY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hou Tao , Richard Weinberger , Vignesh Raghavendra , Sasha Levin , linux-mtd@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 038/330] mtd: cfi_cmdset_0002: don't free cfi->cfiq in error path of cfi_amdstd_setup() Date: Thu, 17 Sep 2020 21:56:18 -0400 Message-Id: <20200918020110.2063155-38-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hou Tao [ Upstream commit 03976af89e3bd9489d542582a325892e6a8cacc0 ] Else there may be a double-free problem, because cfi->cfiq will be freed by mtd_do_chip_probe() if both the two invocations of check_cmd_set() return failure. Signed-off-by: Hou Tao Reviewed-by: Richard Weinberger Signed-off-by: Vignesh Raghavendra Signed-off-by: Sasha Levin --- drivers/mtd/chips/cfi_cmdset_0002.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index a4f2d8cdca120..c8b9ab40a1027 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -794,7 +794,6 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd) kfree(mtd->eraseregions); kfree(mtd); kfree(cfi->cmdset_priv); - kfree(cfi->cfiq); return NULL; } -- 2.25.1