Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13735277pxu; Mon, 4 Jan 2021 03:03:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaQgYhE/cJB3JMUQ7rAbQLnaP+iRw+IoBIFaKmJXFVl/qkOn5YK0nECYwyWNDylVoRqCHi X-Received: by 2002:aa7:c492:: with SMTP id m18mr69395381edq.236.1609758211637; Mon, 04 Jan 2021 03:03:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609758211; cv=none; d=google.com; s=arc-20160816; b=a+HmXmxAZtWTYXHTBKFm5IVp6vv8EXh1d2MRAlA+2YRDQAi5SrwsEANxrqtWw83jjG Wf+TB0MPrLeGYKVjqsORF5qdI11+Ir2qUcnWWG/w7nyKTtQGD4xlPI9Ak8JkvSPgtVA4 5Y/fM8m3Zj06lF/L3cYocUgz0/Tr85y0L6nKUQG1jGmXT7P2zNk22RV0FNmEpWxSE3lz PBuZWHCJ7cEFgmba5JFPz14L1AInE3xpWBNpKjN6I/3WbZ7agotBxNXS7ArkfUk4bZzR 150kktiHcKcCLsZmjbFAjqTENqGRmkMc2s+Bmwvr6qfnrrdF1shcKQUs0du1Dna7/l7F nAvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OS5Jze5MmocChCK8hcdYHMDBk4n13P68Tym0axeAQNM=; b=IzTKTrT7elTaax6hVA/iCGT54ET+kEFzcsZIwmUVtefIIr5wWzzBetNU0d5Gr3Q8uK Fwy76HPIvkKzCJSuScOi8b7ir0136EWONnAg5zzGLx3M04RL9bCtDk1PZU7zdNAybF0s 77pQFfkxrma4dLZZziIZkL2m8h1RhIpqWJWBNmfhX2qZ4WNxdAS0W5KncXO8/28wB/I4 TGiQyW/y5GI5uaOwH5tXSCj7gpH+jFLqrXoESBgvwZIHJgZGozU/XFmmBc62c1yQMF17 kwPrrjGSlxl3yYSjvwegbmi2Ho8jzOJaye9hD9FQ4+yeKXLUvcuYzXyKe0Yxtp4BlYyp vPOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Cy5n5Pj/"; 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 u24si28043841ejb.106.2021.01.04.03.03.08; Mon, 04 Jan 2021 03:03:31 -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="Cy5n5Pj/"; 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 S1726605AbhADLBs (ORCPT + 99 others); Mon, 4 Jan 2021 06:01:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:57148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbhADLBr (ORCPT ); Mon, 4 Jan 2021 06:01:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D185E207BC; Mon, 4 Jan 2021 11:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609758067; bh=FQj1a4rL7iltwr5MqltKp3e514hPbhBndFEkl5LtX3w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cy5n5Pj/MdtkAB+OCBYxr9O9TzdNMSCOoD/SphCZZnso0dbrt6j6KkAIWECtvOpZ3 mefMbVXMCQ0Z1o1X17FUcQ2t+wmyXl/i0O+5EbO7c8eAUUbMmwYXQwhWuL2ekE+CsA wghPhcvMtDfBB3n4/W6iOFUQrw3Mu+D7/RxsL458= Date: Mon, 4 Jan 2021 12:02:33 +0100 From: Greg KH To: Tudor.Ambarus@microchip.com Cc: pavel@ucw.cz, 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 Subject: Re: [PATCH 4.19] dmaengine: at_hdmac: Fix memory leak Message-ID: References: <20200920082838.GA813@amd> <80065eac-7dce-aadf-51ef-9a290973b9ec@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 08:19:18AM +0000, Tudor.Ambarus@microchip.com wrote: > On 9/23/20 11:13 AM, Tudor.Ambarus@microchip.com wrote: > > Hi, Pavel, > > > > On 9/20/20 11:28 AM, Pavel Machek wrote: > >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > >> > >> This fixes memory leak in at_hdmac. Mainline does not have the same > >> problem. > >> > >> Signed-off-by: Pavel Machek (CIP) > >> > >> 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; > >> + } > > > > Thanks for submitting this to stable. While the fix is good, you can instead > > cherry-pick the commit that hit upstream. In order to do that cleanly on top > > of v4.19.145, you have to pick two other fixes: > > > > commit a6e7f19c9100 ("dmaengine: at_hdmac: Substitute kzalloc with kmalloc") > > commit 3832b78b3ec2 ("dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate()") > > commit a6e7f19c9100 ("dmaengine: at_hdmac: Substitute kzalloc with kmalloc") > > this last commit should have been > commit e097eb7473d9 ("dmaengine: at_hdmac: add missing kfree() call in at_dma_xlate()") > > bad copy and paste :) So are all 3 of those needed on both 5.4.y and 4.19.y to resolve this issue? thanks, greg k-h