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] [day] [month] [year] [list]
Message-ID: <66fc4f09.050a0220.10e651.1506@mx.google.com>
Date: Tue, 01 Oct 2024 21:35:36 +0200
From: Miquel Sabaté Solà <mikisabate@...il.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Viresh Kumar <viresh.kumar@...aro.org>,  linux-pm@...r.kernel.org,
  linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: Avoid a bad reference count on CPU node

On dt., d’oct. 01 2024, Rafael J. Wysocki wrote:

> On Tue, Oct 1, 2024 at 8:32 AM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>>
>> On 17-09-24, 15:42, 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@...il.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;
>> >  }
>>
>> Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
>>
>> --
>
> Applied as 6.12-rc material, thanks!

Great, thanks!

Download attachment "signature.asc" of type "application/pgp-signature" (862 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ