lkml.org 
[lkml]   [2022]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe:Re: [PATCH] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c



At 2022-06-17 04:17:19, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>On Thu, Jun 16, 2022 at 4:50 PM Liang He <windhl@126.com> wrote:
>>
>> In meson_secure_pwrc_probe(), there is a refcount leak in one fail
>> path.
>>
>> Signed-off-by: Liang He <windhl@126.com>
>Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>
>[...]
>> pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL);
>> - if (!pwrc)
>> + if (!pwrc) {
>> + of_node_put(sm_np);
>> return -ENOMEM;
>> + }
>Another approach would be to just move devm_kzalloc() a few lines
>further up (above of_find_compatible_node()).
>That would catch similar issues in future when someone wants to add
>more code right after devm_kzalloc(). That said, I don't think that
>this is a likely scenario so the patch is fine for me as-is.
>
>Thanks a lot for submitting this!
>
>
>Best regards,
>Martin

Thanks for your confirm.

Liang
\
 
 \ /
  Last update: 2022-06-17 03:24    [W:1.306 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site