public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Liang He" <windhl@126.com>
To: "Martin Blumenstingl" <martin.blumenstingl@googlemail.com>
Cc: "Neil Armstrong" <narmstrong@baylibre.com>,
	khilman@baylibre.com,  jbrunet@baylibre.com,
	linux-arm-kernel@lists.infradead.org,
	 linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c
Date: Fri, 17 Jun 2022 09:22:52 +0800 (CST)	[thread overview]
Message-ID: <12f4df52.f06.1816f417fcf.Coremail.windhl@126.com> (raw)
In-Reply-To: <CAFBinCB-WZmnMtvG1P=sWASQZCg9F9d-Hg0OzVNUsEutUFX0Cg@mail.gmail.com>




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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-17  1:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 14:49 [PATCH] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Liang He
2022-06-16 20:17 ` Martin Blumenstingl
2022-06-17  1:22   ` Liang He [this message]
2022-06-17  7:31 ` Neil Armstrong
2022-06-17  7:41 ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12f4df52.f06.1816f417fcf.Coremail.windhl@126.com \
    --to=windhl@126.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox