From patchwork Sun Sep 20 08:28:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 11787369 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C65516BC for ; Sun, 20 Sep 2020 08:38:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BD05221EC for ; Sun, 20 Sep 2020 08:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726376AbgITIi0 (ORCPT ); Sun, 20 Sep 2020 04:38:26 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:59824 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbgITIi0 (ORCPT ); Sun, 20 Sep 2020 04:38:26 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id BE7501C0B94; Sun, 20 Sep 2020 10:28:39 +0200 (CEST) Date: Sun, 20 Sep 2020 10:28:38 +0200 From: Pavel Machek To: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dan.j.williams@intel.com, vkoul@kernel.org, ludovic.desroches@microchip.com, stable@vger.kernel.org, Greg KH Subject: [PATCH 4.19] dmaengine: at_hdmac: Fix memory leak Message-ID: <20200920082838.GA813@amd> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org This fixes memory leak in at_hdmac. Mainline does not have the same problem. Signed-off-by: Pavel Machek (CIP) Acked-by: Ludovic Desroches diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 86427f6ba78c..0847b2055857 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1714,8 +1714,10 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, atslave->dma_dev = &dmac_pdev->dev; chan = dma_request_channel(mask, at_dma_filter, atslave); - if (!chan) + if (!chan) { + kfree(atslave); return NULL; + } atchan = to_at_dma_chan(chan); atchan->per_if = dma_spec->args[0] & 0xff;