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]
Date: Fri, 15 Dec 2023 15:31:57 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Linux PM <linux-pm@...r.kernel.org>,
 Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
 Zhang Rui <rui.zhang@...el.com>, Linux ACPI <linux-acpi@...r.kernel.org>,
 LKML <linux-kernel@...r.kernel.org>, Dan Carpenter
 <dan.carpenter@...aro.org>, Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: Re: [PATCH v1] thermal: core: Fix NULL pointer dereference in zone
 registration error path



On 12/14/23 10:52, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> If device_register() in thermal_zone_device_register_with_trips()
> returns an error, the tz variable is set to NULL and subsequently
> dereferenced in kfree(tz->tzp).
> 
> Commit adc8749b150c ("thermal/drivers/core: Use put_device() if
> device_register() fails") added the tz = NULL assignment in question to
> avoid a possible double-free after dropping the reference to the zone
> device.  However, after commit 4649620d9404 ("thermal: core: Make
> thermal_zone_device_unregister() return after freeing the zone"), that
> assignment has become redundant, because dropping the reference to the
> zone device does not cause the zone object to be freed any more.
> 
> Drop it to address the NULL pointer dereference.
> 
> Fixes: 3d439b1a2ad3 ("thermal/core: Alloc-copy-free the thermal zone parameters structure")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>   drivers/thermal/thermal_core.c |    1 -
>   1 file changed, 1 deletion(-)
> 
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -1394,7 +1394,6 @@ unregister:
>   	device_del(&tz->device);
>   release_device:
>   	put_device(&tz->device);
> -	tz = NULL;
>   remove_id:
>   	ida_free(&thermal_tz_ida, id);
>   free_tzp:
> 
> 
> 

Reviewed-by: Lukasz Luba <lukasz.luba@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ