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: <20190820150513.GA12013@roeck-us.net>
Date:   Tue, 20 Aug 2019 08:05:13 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Wenwen Wang <wenwen@...uga.edu>
Cc:     Fenghua Yu <fenghua.yu@...el.com>,
        Jean Delvare <jdelvare@...e.com>,
        "open list:CORETEMP HARDWARE MONITORING DRIVER" 
        <linux-hwmon@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hwmon/coretemp: Fix a memory leak bug

On Mon, Aug 19, 2019 at 04:00:02PM -0500, Wenwen Wang wrote:
> In coretemp_init(), 'zone_devices' is allocated through kcalloc(). However,
> it is not deallocated in the following execution if
> platform_driver_register() fails, leading to a memory leak. To fix this
> issue, introduce the 'outzone' label to free 'zone_devices' before
> returning the error.
> 
> Signed-off-by: Wenwen Wang <wenwen@...uga.edu>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/coretemp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index fe6618e..d855c78 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -736,7 +736,7 @@ static int __init coretemp_init(void)
>  
>  	err = platform_driver_register(&coretemp_driver);
>  	if (err)
> -		return err;
> +		goto outzone;
>  
>  	err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hwmon/coretemp:online",
>  				coretemp_cpu_online, coretemp_cpu_offline);
> @@ -747,6 +747,7 @@ static int __init coretemp_init(void)
>  
>  outdrv:
>  	platform_driver_unregister(&coretemp_driver);
> +outzone:
>  	kfree(zone_devices);
>  	return err;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ