Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352074pxb; Mon, 20 Sep 2021 19:48:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbcrjKnvSwk6iIIHOWgiUMzzXIf7wwHDSr9UjNVkHJKaPi4A76BBqDOPftsWhrJ7v0nHv4 X-Received: by 2002:a50:d4dc:: with SMTP id e28mr31595526edj.106.1632192534881; Mon, 20 Sep 2021 19:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192534; cv=none; d=google.com; s=arc-20160816; b=qXMpJwxQEF9Znic5bfYQC6cXQovtQBCKBm3ldqCf/pOn6oqqO0bAeclNOfkBqv/qNo u9GyUlCz9+Xq6WSfvfyM0rP6at/Mo8Ttfg1hWD79sbnuc20HZMpNMC1w2EyNrXVfwSLB NOK+Yh7dPBuMYnbwT2oPjgpqe0fflh1n5CEVIGm+ux7Js1Dg3yzVvJC7WfhluVsqxZXA O6vLxA/0mmz3M2fcKlsLSJkGY9z7N/9VeJTlicU2T95EFAxVa6d0DTTzhfdc6dEkLB6W BJ8yOXvHlxp6oqg0KlWefMnWm1llDCVZWs1szSvlClLp9o/h8K0nMedghRn8EyQDjTTw dDFw== 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=BQn0I/LWRFWJs/FGxC2J2ZjR/uMzzU8+vhYf9o3puxQ=; b=lTg/Sxy9GL4UNyG9UVbF7/HAW6xrhZq1T67xBqRJ1YDbqTQ9a4uW4PYwcfEoTAXXgP 4bJBPumDcmf8LQk6aam4XXHSzd7Fr5YGtFjRMOMhtjDUkTFVg7+DKVQVj2oUyF7WrkAT 6WzReQAd8TyvHoXK5DOrFVSHZha/hf3VHQd/oRmR/QQl8W3Y1fs04IgfxE0fYMFZUl4r x4XBVPOb6CyyGPWxGCyE2W6Owu0y1ZqmZQfzPGEBRpCAEXfBRX82bsUkGzTJdZF43myz iHrJ+k1MXwSkCzW88FTS1jApLwO2GoJlJ56Wu0DsmtVSyINqm2DzUWNrUur8l6+8Vlae mHHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSf4DIEU; 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 t26si4547750edi.360.2021.09.20.19.48.30; Mon, 20 Sep 2021 19:48:54 -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=OSf4DIEU; 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 S1379152AbhITS2Z (ORCPT + 99 others); Mon, 20 Sep 2021 14:28:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:43180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348448AbhITSWV (ORCPT ); Mon, 20 Sep 2021 14:22:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5490B632B9; Mon, 20 Sep 2021 17:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158649; bh=3fYyaJ4Xf31JXWgk6Y3IPHvm2t7r5vua+XlOfzUZYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSf4DIEUqs1BwZTkWB+zif2c/SMDR15H0zat4BbKlvy8CqGNKourcqFuF5wAL5EoU ZfvL7mki5zWR5HM6XiFZ9SOUOzrpT88s+ztAbmKwb9z+SVfpkF7HG56JopFBeldPB4 G5DRIHR7Zi6E8l3MMztxUEO5i0Lip5qSp4iRP9aU= 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.4 252/260] mtd: rawnand: cafe: Fix a resource leak in the error handling path of cafe_nand_probe() Date: Mon, 20 Sep 2021 18:44:30 +0200 Message-Id: <20210920163939.671365802@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 2d1c22dc88c1..cc5009200cc2 100644 --- a/drivers/mtd/nand/raw/cafe_nand.c +++ b/drivers/mtd/nand/raw/cafe_nand.c @@ -757,7 +757,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 */ @@ -801,6 +801,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