lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_F796C219AAAF44C38D59EDDB560958888706@qq.com>
Date: Sun, 13 Jul 2025 00:27:39 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: vkoul@...nel.org,
 magnus.damm@...il.com,
 robin.murphy@....com,
 ulf.hansson@...aro.org,
 kuninori.morimoto.gx@...esas.com,
 u.kleine-koenig@...libre.com,
 dmaengine@...r.kernel.org,
 linux-renesas-soc@...r.kernel.org,
 linux-kernel@...r.kernel.org,
 Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
Subject: Re: [PATCH] dmaengine: rcar-dmac: Fix PM usage counter imbalance

Hi Geert,
Thank you for reviewing my patch and providing the Reviewed-by tag. 
I appreciate you pointing this out. Testing these fixes comprehensively has been challenging 
as QEMU doesn't support the Renesas R-Car SoC, which makes it difficult to verify the complete
behavior of the driver.
I'll continue working on addressing the memory leak issue where the function doesn't free previously
allocated memory on failure.
Thanks again for your thorough review.
Best regards,
Zhang Shurong

> On Jul 2, 2025, at 18:18, Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> 
> Hi Zhang,
> 
> On Sun, 29 Jun 2025 at 17:57, Zhang Shurong <zhang_shurong@...mail.com> wrote:
>> pm_runtime_get_sync will increment pm usage counter
>> even it failed. Forgetting to putting operation will
>> result in reference leak here. We fix it by replacing
>> it with pm_runtime_resume_and_get to keep usage counter
>> balanced.
>> 
>> Fixes: 87244fe5abdf ("dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver")
>> Signed-off-by: Zhang Shurong <zhang_shurong@...mail.com>
> 
> Thanks for your patch!
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
> 
>> --- a/drivers/dma/sh/rcar-dmac.c
>> +++ b/drivers/dma/sh/rcar-dmac.c
>> @@ -1068,7 +1068,7 @@ static int rcar_dmac_alloc_chan_resources(struct dma_chan *chan)
>>        if (ret < 0)
>>                return -ENOMEM;
>> 
>> -       return pm_runtime_get_sync(chan->device->dev);
>> +       return pm_runtime_resume_and_get(chan->device->dev);
> 
> Note that there are other issues with this function: in case of failure,
> none of the memory allocated before is freed.  Probably the original
> author assumed none of this can really fail.
> 
>> }
>> 
>> static void rcar_dmac_free_chan_resources(struct dma_chan *chan)
> 
> Gr{oetje,eeting}s,
> 
>                        Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                -- Linus Torvalds



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ