Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3742895pxk; Tue, 29 Sep 2020 05:17:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjtngpySM6CH8e2Ob0+mq7jghv1nxctHHoic1O2h/kS+DixiQ7CztIG2i0B7F5Xku3Crl+ X-Received: by 2002:a50:d98d:: with SMTP id w13mr3053215edj.37.1601381878996; Tue, 29 Sep 2020 05:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601381878; cv=none; d=google.com; s=arc-20160816; b=Tis7CWbkdYrzA3oN21QLYA/wH6AJ2qTNB/Kh0QgFeqlyagu2h2Y0pMIQb/ogPrdNXi 827ieV9CkxBBfwMvuYE7jXnVcMJH6rsk5sTt7VgAN6wwRHaAc2JeSkjHpohAnR/FIm8w HMO4AY/2Qhi9vmZwfs3GwW/M/oV19MDVkxMhQbUQof3nsG2pg5lBhznpAUQMlji5my39 ezBGDliu5mlDxFK5YluAaKyp+Y4srZHJ4adclS+OrChXQ5BvX0oLpFUU+/Rte46TSBLK HwSJH8YFondmKAqVpkVCJlZOLlJMvnYp+snnbmIy/1FskJOk8WFeDWIfg22IQjOiSb1K ZgGw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t+X3Mws94zqzJUe1r2joY+CAu7+tcWaiolvh5R61vS4=; b=W117+3v+Z/zpR7M5F/P0S5nJlucob5RpHQndWo+V2YO6Dtc6wGhw1G9eHs93py5Oz3 6x1yBVHLSYibXxuOHfyv6ejHLhqLRuD6u++Vsgw7M/fa7q6br/HoP2rv1IL4iaAExi2d HBJk2Pco8OGouC4GdlV+Px0VDvaQ2bEHfehlRoM8HWficGzxHD7Q+v+b2ScbX0i2xLty DkHxUCAmYtDU1d5fAUALkUe0gB943MCdCdVIcOzUvg0pEd27w9xHvgwGPGuQrwwdyeoA VtbJ6ahchpFnFFMfi8ek/Co9VzeftM5yenbiwXa7YN87m6EBBGf11VC6SUy60uYifP9t mn/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0vBHwlcs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si2775546edc.112.2020.09.29.05.17.36; Tue, 29 Sep 2020 05:17:58 -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=0vBHwlcs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732269AbgI2MQS (ORCPT + 99 others); Tue, 29 Sep 2020 08:16:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53442 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730042AbgI2LhA (ORCPT ); Tue, 29 Sep 2020 07:37:00 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8249323AC9; Tue, 29 Sep 2020 11:32:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379151; bh=hUeHE+59BPSZBYX15nEVEG9KNRYhI3yfLK/6Y4HSMjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0vBHwlcsjRSz8Zw/qXkaJeoentfkOPlLU0L+EFIvekSK/OFn9f3MYzenq0mAiGLvJ L/R8A+M80/DAmr53KVKzVDiu867vaQ8nEvx87cv3ziYGhH8sdCiz9HwrsTwVWGmYzT nQAkKipT1lBYQ3xxP/mZVDJFOZSJ22S7nzaz5xMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Richard Weinberger , Vignesh Raghavendra , Sasha Levin Subject: [PATCH 5.4 036/388] mtd: cfi_cmdset_0002: dont free cfi->cfiq in error path of cfi_amdstd_setup() Date: Tue, 29 Sep 2020 12:56:07 +0200 Message-Id: <20200929110012.238112810@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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