Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2354048pxb; Mon, 20 Sep 2021 19:53:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFv/YrlAxqhCuwL46j/VhTIN1YEFMa4RxqSJIvArOXWnm7k3cSrCXPN1WV+qMdZ7QHBh8a X-Received: by 2002:a50:e04e:: with SMTP id g14mr26653093edl.168.1632192785669; Mon, 20 Sep 2021 19:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192785; cv=none; d=google.com; s=arc-20160816; b=QWqPoA6cXLYH2He2pzo7tf1+HVKmJQrik5bpHxCAoYhMgRBCt2AkH5LlVFL9Wpk4HD U0axRWZkkMttjJolXaBikhhGz6FMWfltnsnc2mxzdqCMTsTYif5zw92+GFZJWsMB/bPo e6SqnrKoAbohC/LbwXiUarCj9UCFM7ScgW47bsASPKTQ3bebGPrsCuw5UEAgycIMHPze FFjkALWdknQPVxs7FjtGSNj2G0M7ZelGoHO3c8mAcxoKeR34Fp2BRus4aDmDPi/rzV6s GzLi3+yTArsXQBxOMSx8rk26VTRLk2dQ24GAimZZTEPD5morzKgnsy1ijV+17NVNPYgd 7IBg== 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=Yd0OPLJprDUzJyYtQ3tROdgAZthxIQUYoQaBw/LY7kE=; b=YhzGhFilBxDqrOEt9U/b3FgYFh33SMcg2h+5ArpOKICI/DpVX61Qb1EBk6qjGn/hxh uD9Uxj2/UAQoSCR7C9E1qqvVHoOE/BFrPvzXkYcAB8UOBL4qGGm23PcvdzYhdtV/Xvxf vVUrVb4fN6jxSsvUdYoGDwBvP1kSwDW/srH8gHjFC0wtN/LaZdFp7n36d9YqZXMdS0bH hL2DwR7kFBd7Q3kZuiPCsW3K/XgK53Hqj+HVoJh6L49uFFOzzZpjOp5SOmaRJ8HMsilK EvKAHstlZNcYvp3Fan7AYspdSsl7aZsL/o5tXrjV+hI4yll/okTJDzulHeosdRmc1Kga DJeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yRWQJJW2; 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 j23si22299800eje.719.2021.09.20.19.52.41; Mon, 20 Sep 2021 19:53:05 -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=yRWQJJW2; 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 S1386163AbhITSxq (ORCPT + 99 others); Mon, 20 Sep 2021 14:53:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:37308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385534AbhITSue (ORCPT ); Mon, 20 Sep 2021 14:50:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FAC361503; Mon, 20 Sep 2021 17:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159305; bh=0x2De22Szmsl8Wa6aJUPQ0rUXTWgSLDA/cNGXPNVDSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yRWQJJW2Cw/MuSNMzsVrRFsdDRc+P4WnlsPblj95PQ1vxqdyLT1TxZByw97OhcmLV wlu0jhTY8WrjMT3Ga3BOfoYSpRubs+YkehYbe2BG/TyE+C8xFgnbn6BBs8Vj07xmr8 mla1eqbEVvbhjcJROa+hPJBovlg6HgIYNM9PIoZs= 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.14 138/168] mtd: rawnand: cafe: Fix a resource leak in the error handling path of cafe_nand_probe() Date: Mon, 20 Sep 2021 18:44:36 +0200 Message-Id: <20210920163926.194334077@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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 d0e8ffd55c22..9dbf031716a6 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