From: "Miquel Sabaté Solà" <mikisabate@gmail.com>
To: rafael@kernel.org
Cc: viresh.kumar@linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq: Avoid a bad reference count on CPU node
Date: Tue, 01 Oct 2024 07:27:08 +0200 [thread overview]
Message-ID: <66fb882e.7b0a0220.1118d5.90ca@mx.google.com> (raw)
In-Reply-To: <20240917134246.584026-1-mikisabate@gmail.com> ("Miquel Sabaté Solà"'s message of "Tue, 17 Sep 2024 15:42:46 +0200")
[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]
On dt., de set. 17 2024, Miquel Sabaté Solà wrote:
> In the parse_perf_domain function, if the call to
> of_parse_phandle_with_args returns an error, then the reference to the
> CPU device node that was acquired at the start of the function would not
> be properly decremented.
>
> Address this by declaring the variable with the __free(device_node)
> cleanup attribute.
>
> Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
> ---
> include/linux/cpufreq.h | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index d4d2f4d1d7cb..aabec598f79a 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -1113,10 +1113,9 @@ static inline int parse_perf_domain(int cpu, const char *list_name,
> const char *cell_name,
> struct of_phandle_args *args)
> {
> - struct device_node *cpu_np;
> int ret;
>
> - cpu_np = of_cpu_device_node_get(cpu);
> + struct device_node *cpu_np __free(device_node) = of_cpu_device_node_get(cpu);
> if (!cpu_np)
> return -ENODEV;
>
> @@ -1124,9 +1123,6 @@ static inline int parse_perf_domain(int cpu, const char *list_name,
> args);
> if (ret < 0)
> return ret;
> -
> - of_node_put(cpu_np);
> -
> return 0;
> }
Gently ping :)
Do you have some time to take a look at this fix?
Thanks,
Miquel
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2024-10-01 5:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 13:42 [PATCH] cpufreq: Avoid a bad reference count on CPU node Miquel Sabaté Solà
2024-10-01 5:27 ` Miquel Sabaté Solà [this message]
2024-10-01 6:32 ` Viresh Kumar
2024-10-01 18:46 ` Rafael J. Wysocki
2024-10-01 19:35 ` Miquel Sabaté Solà
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=66fb882e.7b0a0220.1118d5.90ca@mx.google.com \
--to=mikisabate@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
/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