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  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]
Date:   Fri, 1 Oct 2021 20:45:07 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Anel Orazgaliyeva <anelkz@...zon.de>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Aman Priyadarshi <apeureka@...zon.de>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpuidle: Fix memory leaks

On Wed, Sep 15, 2021 at 5:45 PM Anel Orazgaliyeva <anelkz@...zon.de> wrote:
>
> > On Wed, Sep 15, 2021 at 02:14:56PM +0200, Rafael J. Wysocki wrote:
> > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
> >
> >
> >
> > On Mon, Sep 6, 2021 at 8:35 PM Anel Orazgaliyeva <anelkz@...zon.de> wrote:
> > >
> > > Commit c343bf1ba5ef ("cpuidle: Fix three reference count leaks")
> > > fixes the cleanup of kobjects; however, it removes kfree() calls
> > > altogether, leading to memory leaks.
> >
> > Wait, won't the cleanup be done by cpuidle_free_state_kobj()?
>
> For state cleanup, cpuidle_free_state_kobj() is called on the all the previously created kobjs:
>
> error_state:
>         for (i = i - 1; i >= 0; i--)
>                 cpuidle_free_state_kobj(device, i);
>
> so we still need to cleanup the kobj created in the current iteration.
>
>
> For overall sysfs, the flow is as follows:
>
> cpuidle_register_device
>      ret = cpuidle_add_sysfs(dev);
>     if (ret)
>         goto out_unregister;
>
> out_unregister:
>     __cpuidle_unregister_device(dev);
>    goto out_unlock;
>
> so when there is an error in cpuidle_add_sysfs() dev doesn’t get freed.

OK, applied as 5.16 material, thanks!

Powered by blists - more mailing lists