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: <cb82c739-b496-670a-13dd-0f1a37c085f8@gmx.de>
Date:   Thu, 20 Jan 2022 18:27:22 +0100
From:   Helge Deller <deller@....de>
To:     Miaoqian Lin <linmq006@...il.com>,
        "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
        Greg Kroah-Hartman <gregkh@...e.de>,
        linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] parisc: pdc_stable: Fix memory leak in
 pdcs_register_pathentries

On 1/20/22 13:18, Miaoqian Lin wrote:
> kobject_init_and_add() takes reference even when it fails.
> According to the doc of kobject_init_and_add():
>
>    If this function returns an error, kobject_put() must be called to
>    properly clean up the memory associated with the object.
>
> Fix memory leak by calling kobject_put().
>
> Fixes: 73f368cf679b ("Kobject: change drivers/parisc/pdc_stable.c to use kobject_init_and_add")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>

applied.
Thanks!
Helge


> ---
>  drivers/parisc/pdc_stable.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
> index 9513c39719d1..d9e51036a4fa 100644
> --- a/drivers/parisc/pdc_stable.c
> +++ b/drivers/parisc/pdc_stable.c
> @@ -980,8 +980,10 @@ pdcs_register_pathentries(void)
>  		entry->kobj.kset = paths_kset;
>  		err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL,
>  					   "%s", entry->name);
> -		if (err)
> +		if (err) {
> +			kobject_put(&entry->kobj);
>  			return err;
> +		}
>
>  		/* kobject is now registered */
>  		write_lock(&entry->rw_lock);
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ