Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2320245pxb; Mon, 20 Sep 2021 18:43:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzwIVKQtgjK18p1v8qV6CYpvqOFzYauEFP27ol6Feom6Lo08s8sZxr7YWuKfdip+iCNXkR X-Received: by 2002:a05:6e02:1b89:: with SMTP id h9mr19242159ili.297.1632188632548; Mon, 20 Sep 2021 18:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188632; cv=none; d=google.com; s=arc-20160816; b=djM71bje2lgzOrUSEFgHW2wB4wvDncuL4i76kzBNOgee1Jk8GaXV5jX3m6RfEEklrt 4HUWkPXEUfJbkBVDOHdI1o0KyF196iJl/PfUVNhGI70HoRck5/w4JWWFAiEL8NtBJQmq uoVA4eAnnCr/2LrCoDRiqXpajiNjQiY71OBru6kpRuCaurKr7wjgaoTngekfz42339x/ zBIiIu+BTtXUmYzjUN0RtJ46/7HTDRxytkjwl/eIhQVmexo9mPtDCVKQAzYKbAlEZXxS aVaJk8ehRAo5YqPj1V0kemFNSRElS/HTSsGWaKxamXAZ42XtfiOlaO+e8llRBnyajncp NN1Q== 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=XSGPeug8K6qCe58kLRvOW8K6eYlRF/FAFZiJtWAuN/k=; b=KCbhV/sqJsYrT7UBJ16lkam2L3cmM8FUB1l7BWLhXyBQ3EFHFxcA77cgQQCfdXZNng SyWFuZuhOrPbFeENg345gDFxVDVTll/VJNcSOt9k4mPZXWD2epfNhqAAu+80ivek1WAW BVn2qG7RUVmYZAos8+coKwULrRbykV/vBg9Wc6Ldnb9PipnkxQX06bV0sSuuU7kPUCSn NW/ykJNVkfpQpUUahwbVFFxpUlYUh73GYwVDUqMkaSY0eDKe7501a408OgYXdCtdITQp hoUmEDf5Pe2S8HTJBkUkx3cuGlg781dBQfjz3YcMDPhBuQFQBztUwDLj13Zrx0Pm4YwS U7tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e7oEJB8d; 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 s10si13731235ioo.6.2021.09.20.18.43.41; Mon, 20 Sep 2021 18:43:52 -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=e7oEJB8d; 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 S243927AbhITQ4g (ORCPT + 99 others); Mon, 20 Sep 2021 12:56:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:36554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239686AbhITQw5 (ORCPT ); Mon, 20 Sep 2021 12:52:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 537F161262; Mon, 20 Sep 2021 16:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156608; bh=qDrCOMdr/NFjhMCnCQlBYrmyTBsDnplsjGAP78noA0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e7oEJB8d9OOf6DJIIYgdXM5cHQF4jRbdqJs2d4CPMbK4tFKgLPqBsiVea/NUyf30X a31tvOxPnMs8O/lrLo45NbkRTL2h2ZpHx38MyRb8Xs3x6GnpR0m2wxYphB6jIlFzFw EEgPPIwJ3oU46AV4Bg9SciFbje2Vj//5oH9kodmQ= 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 4.4 130/133] mtd: rawnand: cafe: Fix a resource leak in the error handling path of cafe_nand_probe() Date: Mon, 20 Sep 2021 18:43:28 +0200 Message-Id: <20210920163916.873925590@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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/cafe_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index 9de78d2a2eb1..10c063d73ee3 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c @@ -672,7 +672,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 */ @@ -781,6 +781,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