From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD75C433E0 for ; Wed, 6 Jan 2021 16:54:04 +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 7CAEE22EBD for ; Wed, 6 Jan 2021 16:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CAEE22EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RLbkvw88MX5Ar8S8pIss93B2M5pxvb0RT0ed0NR8L5I=; b=yQUnZLo2Vo1sRwlCJn/rxWBIK ksUcXdzOpW4HaRvzDXFC689yThL7Mt5p5VApsQk2ogPDb+ofw1y4DuprWesE3J+YT2eOjpYSm1/uQ 2LAS+/ft8Oo25kcUv6dOXq0l00NWKlC2tqkN/sj6/xN3HwdGHEVSWSc4AmjBjYNAmzL9xChtxtRiI XLZUApQSzYMsoOvPu+gKuEkXtdJadiVDgcPK4uS7HNCC748r4kQqe6nquRqQkPKkG1oX0JF17figW XbMsa+nN+yMRcanD4oeYV1lv4q69+j2zbOoLgsyNLDl9hPaYWE4qo3eJpAAEgo4SiffMDMVFB5Tkw 8QyXroUCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxC2T-0005Ue-2e; Wed, 06 Jan 2021 16:52:01 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxC2Q-0005UD-FO for linux-arm-kernel@lists.infradead.org; Wed, 06 Jan 2021 16:51:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A12023135; Wed, 6 Jan 2021 16:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609951917; bh=IMFq1KTGJiGS26sa9cl/BORdVmQ9PX8XxqpL5Ht486M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M7J09CsoIrOgg2W3ZZhl1Sm3PPOgai/rGTDRZuCP8FaiFkPMRjqOeoNypbZhwFbDa hthH8l1PrJjZd5d0qjsprIUUFZDHPaE/NP6b7B4nZiNq+7CltAz/Fb6rRBvDyWb4Oe OUOC1gZWitEDjvHLLaMMCeN+/9aIxslmxVrBHbQM= Date: Wed, 6 Jan 2021 17:53:19 +0100 From: Greg KH To: Tudor.Ambarus@microchip.com 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210106_115158_600847_9FE4B63B X-CRM114-Status: GOOD ( 23.00 ) 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: , Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, vkoul@kernel.org, Ludovic.Desroches@microchip.com, pavel@ucw.cz, dmaengine@vger.kernel.org, dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 05, 2021 at 08:03:20AM +0000, Tudor.Ambarus@microchip.com wrote: > On 1/4/21 1:02 PM, Greg KH wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > 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? > > > > Yes. I've just cherry-picked all three commits on both v5.4.86 and v4.19.164, > everything looks ok. I also compiled using sama5_defconfig, all good. > > The order in which they should be taken is 1/ a6e7f19c9100, then 2/ 3832b78b3ec2, > and 3/ e097eb7473d9. Thanks, will go queue those up now. greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel