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: <CAJZ5v0jNUPqAGZ9RO4UYyT_kQdG1fPqkFaRLp854tavzLe8R+A@mail.gmail.com>
Date:   Fri, 29 May 2020 18:08:50 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     wu000273@....edu
Cc:     Kangjie Lu <kjlu@....edu>, "Rafael J. Wysocki" <rjw@...ysocki.net>,
        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 several reference count leaks.

On Thu, May 28, 2020 at 8:21 PM <wu000273@....edu> wrote:
>
> From: Qiushi Wu <wu000273@....edu>
>
> kobject_init_and_add() takes reference even when it fails.
> If this function returns an error, kobject_put() must be called to
> properly clean up the memory associated with the object. Previous
> commit "b8eb718348b8" fixed a similar problem.
>
> Signed-off-by: Qiushi Wu <wu000273@....edu>
> ---
>  drivers/cpuidle/sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
> index cdeedbf02646..55107565b319 100644
> --- a/drivers/cpuidle/sysfs.c
> +++ b/drivers/cpuidle/sysfs.c
> @@ -515,7 +515,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
>                 ret = kobject_init_and_add(&kobj->kobj, &ktype_state_cpuidle,
>                                            &kdev->kobj, "state%d", i);
>                 if (ret) {
> -                       kfree(kobj);
> +                       kobject_put(&kobj->kobj);
>                         goto error_state;
>                 }
>                 cpuidle_add_s2idle_attr_group(kobj);
> @@ -646,7 +646,7 @@ static int cpuidle_add_driver_sysfs(struct cpuidle_device *dev)
>         ret = kobject_init_and_add(&kdrv->kobj, &ktype_driver_cpuidle,
>                                    &kdev->kobj, "driver");
>         if (ret) {
> -               kfree(kdrv);
> +               kobject_put(&kdrv->kobj);
>                 return ret;
>         }
>
> @@ -740,7 +740,7 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
>         error = kobject_init_and_add(&kdev->kobj, &ktype_cpuidle, &cpu_dev->kobj,
>                                    "cpuidle");
>         if (error) {
> -               kfree(kdev);
> +               kobject_put(&kdev->kobj);
>                 return error;
>         }
>
> --

Applied as 5.8 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ