Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp399899pxb; Wed, 3 Mar 2021 06:13:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNbrfee2N4NZCrLPK6iSboerCQ3kEXoPoBWr9ZU2sigsSrzQ+GIKAJJas1quMKf+y4GdOK X-Received: by 2002:a17:906:bb06:: with SMTP id jz6mr971140ejb.429.1614780818537; Wed, 03 Mar 2021 06:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614780818; cv=none; d=google.com; s=arc-20160816; b=StVUo/lRG/vwR1CEs2Ctjz4FWvvOx7vVlwvAWP3V2FiT8oeZ5PaCSoxRLreYGlOyU2 ZITh4Tz8SnPOIqucSB/QsVw62HW6l2v/zgbA/q3sTJfI95q1bl+kmvNsE2p53vrwJtVL xQjNC3WffiiFKX/xce0iC0azexKIJun2nOZOuUV6XwQlMH7/plVVKDIKB+t/M69ZB1hn dZUjq+b6h1LI8VIz0fkSU8ASjwfsydV1DIBUlocEQMMOsKkHrFwaRsCUhW42/dY4KjWF 3KmIo416XGPxKZKnJS77E7KVHnBggaFHDkTaJWiaPVhGzN+ZhNgfm5T8xVnyYZiK9Cxc KyDQ== 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=YPv/yYP3bsyjB8HuzLUgD/anubqC2PmWWFjFkI9pXWY=; b=JOUTH1lcAZhV60mV5E2pc8s++wYfgYNjddDybHSOvI6sjs7QiWT311swy8yOry+GI3 UJXm+UiPTTSaShCWKK81nThWKcpQeYMVjuTdArrIDJPJzZYzWOcwuY9Sj72Y0xaSIzoI 6Ln77SO382DX8SyYck908zPdy3OIVAHbRUdR9cHzONrqgkkSGt0xVIYZcqPGg0etSDXQ P3fh+Ymc11DkBy41IKJ1K9XPP4jJu91nWEa4GheQ971T/P4Q4aiJNmKQQhfcEuXku0QY BVAV084192F5QCu0EdF4id+KcnOdYNLw7YcN/YPQG5NhHmpOKvfHcZULp0PKtWiKG0u3 WSSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1u6+Uv+T; 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 c11si4682873edv.591.2021.03.03.06.13.05; Wed, 03 Mar 2021 06:13:38 -0800 (PST) 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=1u6+Uv+T; 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 S243533AbhCAUd2 (ORCPT + 99 others); Mon, 1 Mar 2021 15:33:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:36350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237086AbhCARHj (ORCPT ); Mon, 1 Mar 2021 12:07:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B225164F7B; Mon, 1 Mar 2021 16:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616843; bh=nFYfDVaO2qIceaxVSQmrrkMzf1+Y2HWYZyLWgu2Jqj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1u6+Uv+TrflVWmVmqJe+t1bVmfKXxGr/BycjSMs0PeP0h7OGNA7x1Aqvw69rmiDPr HRrAa+kt2TjVd/zZ3B1fhBEL3FA8WECAASqmLNe5Us6ZhlQbjpqvCyvBTbE94Wuy28 QyrrXtFQoY1X/nvzqL351jca0zwai9tNm/EhTfQU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 114/247] dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function Date: Mon, 1 Mar 2021 17:12:14 +0100 Message-Id: <20210301161037.253339487@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@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 b202d4e82531a62a33a6b14d321dd2aad491578e ] In case of error, the previous 'fsl_dma_chan_probe()' calls must be undone by some 'fsl_dma_chan_remove()', as already done in the remove function. It was added in the remove function in commit 77cd62e8082b ("fsldma: allow Freescale Elo DMA driver to be compiled as a module") Fixes: d3f620b2c4fe ("fsldma: simplify IRQ probing and handling") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/20201212160614.92576-1-christophe.jaillet@wanadoo.fr Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/fsldma.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index e3412be957122..e7ca3175dbc30 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1218,6 +1218,7 @@ static int fsldma_of_probe(struct platform_device *op) { struct fsldma_device *fdev; struct device_node *child; + unsigned int i; int err; fdev = kzalloc(sizeof(*fdev), GFP_KERNEL); @@ -1296,6 +1297,10 @@ static int fsldma_of_probe(struct platform_device *op) return 0; out_free_fdev: + for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) { + if (fdev->chan[i]) + fsl_dma_chan_remove(fdev->chan[i]); + } irq_dispose_mapping(fdev->irq); iounmap(fdev->regs); out_free: -- 2.27.0