Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352129pxb; Mon, 20 Sep 2021 19:49:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0tZBQb5wUHo1PkBagP4xuHfsbIqP6/t5f9tOEYS+7N5ipMrooziKKTSSpgLBmZxuq2dmg X-Received: by 2002:a5d:8a05:: with SMTP id w5mr20140164iod.155.1632192541848; Mon, 20 Sep 2021 19:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192541; cv=none; d=google.com; s=arc-20160816; b=NfcKFgjeFRaYnpVDO0nz2POjarpW4d9DlpZxFXsPEciv7JBIjCWSRrNHCnWi3zkaRB NbHBcBmL5S87POL1Ut06w/OzpAeJ6y4+cnLTdNA5VuHhvH8kCIV/+DM66/JAbH4j8wI2 Ov8vzi9gaXBTjgdUWZyqyGI3a3EOMnTv4dNpNiKDt5UPN60yNwDOr0szKHHvn842GX/K kak0lX5yfFYpGkLaBz4GdIDh7VLLNWvt3U7vmfXytBrVC5QR9JwIcVCbcyiu3Gby+kIT MjNv743rJxdUnsGUSJ8vKnQya6u9zlZ1+D+itXomZ5CFX+BGCWGW4BiJLvJ4nqKYvJQs m3TA== 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=ZjJyynZ3KaRNSuWmfxjPp+9ioJsiIyh5+eDgrCzqMts=; b=B2moZA/yGHz92XySEqwTuzBfV9BgAxMdCfDaFyNvdd8f0IoTgTAVWgVPXeznbQ8AY5 gOLSbK1pZ2oqJ56iaQvv7udn86NW+7eM0LNdPWUutspv+SKyUnd1kWFq1AHnRxjG0al2 QSNhic8WOjYh4UJYNSfYPOjFbsBtDeF897FxwDh8r727lw5e5C5MHDTPVnu6+gVo4WIt YJY6WEJfgzwZcyqPPox20aVYGWz5/txKlPX5mW7pACmwibLPEe2bXB5k+oEw5AcQVUZ7 9SDmpkeZjNzLOA9/JMtLbHX3EIw/ilrDQMjGOKo8enPsVm3GH/fD4Pdm3kJG5LQvhv3I ohPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hK6nc1eB; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si13422423ilr.112.2021.09.20.19.48.51; Mon, 20 Sep 2021 19:49:01 -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=@linuxfoundation.org header.s=korg header.b=hK6nc1eB; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353279AbhITSiS (ORCPT + 99 others); Mon, 20 Sep 2021 14:38:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380245AbhITSdA (ORCPT ); Mon, 20 Sep 2021 14:33:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2E1763300; Mon, 20 Sep 2021 17:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158890; bh=iPcAdKpEal/vYsmVKcKCYgrw5uPJyRr09LrDNdbj0uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hK6nc1eBNs2J0Z79Mk21OGBkpB7YCJe70K3JHkuRBBXa4JBvNSlDiQUN64CsVFx77 8Hp3/8iY6HNFArTXnmG/aj6NRwryNajTmsQGNzFWJf+Z7Mp2r3xHXi0iuM+hH0y19X MC3QDxAdk2HKvvaZrWELj9Lr0xZpt0DxN27zddec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Miquel Raynal , Sasha Levin Subject: [PATCH 5.10 095/122] mtd: rawnand: cafe: Fix a resource leak in the error handling path of cafe_nand_probe() Date: Mon, 20 Sep 2021 18:44:27 +0200 Message-Id: <20210920163918.908001008@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@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: Christophe JAILLET [ Upstream commit 6b430c7595e4eb95fae8fb54adc3c3ce002e75ae ] A successful 'init_rs_non_canonical()' call should be balanced by a corresponding 'free_rs()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC") Signed-off-by: Christophe JAILLET Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/fd313d3fb787458bcc73189e349f481133a2cdc9.1629532640.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/cafe_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c index 2b94f385a1a8..04502d22efc9 100644 --- a/drivers/mtd/nand/raw/cafe_nand.c +++ b/drivers/mtd/nand/raw/cafe_nand.c @@ -751,7 +751,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, "CAFE NAND", mtd); if (err) { dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); - goto out_ior; + goto out_free_rs; } /* Disable master reset, enable NAND clock */ @@ -795,6 +795,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, /* Disable NAND IRQ in global IRQ mask register */ cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); free_irq(pdev->irq, mtd); + out_free_rs: + free_rs(cafe->rs); out_ior: pci_iounmap(pdev, cafe->mmio); out_free_mtd: -- 2.30.2