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: 11787367 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 759ED59D for ; Sun, 20 Sep 2020 08:28:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 47D9E2084C for ; Sun, 20 Sep 2020 08:28:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LfseY55/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47D9E2084C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=lZ2WTlKSHAK6nc+O6OX9KsRZKTzjxY5ZpvXn3TS6Eqw=; b=Lfs eY55/bT5NNToA05pSl/LhTRMCTV/l/RW6CUEzpNY04QZNvVhFRU4tH9C/+fSJeUpMd3US5T3JlBzL QZl7OurRkWpGsROpOER0wFcpJTnhrYB2HVBPF3xhuIIzsZRoEqMBQSTt2rDIM4z379LhEM02JDuqF mPDyUPc7h4dgYz8hikeQ5KGFI9wgbCDjaTV/ny5Qx8bhPdJWqlJBHijbZ6L0T+S6T1JRflSpIV2w0 SlBD4GGltWEZn9wBpjMmENW/AewLAGMMzwk2TFBxzTqzp/m0cbYA/QteP6zYkjrov2+BkXMSjJZET OiX7zv0z5uhEcJQjTRiqW0jhhrqzjCw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJuiF-0002O4-Lj; Sun, 20 Sep 2020 08:28:47 +0000 Received: from jabberwock.ucw.cz ([46.255.230.98]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJuiD-0002NV-1C for linux-arm-kernel@lists.infradead.org; Sun, 20 Sep 2020 08:28:46 +0000 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 User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200920_042845_189097_2C566FBC X-CRM114-Status: GOOD ( 12.82 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;