mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
thermal: core: Fix NULL pointer dereference in zone registration error path
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). Commitadc8749b15
("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 commit4649620d94
("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:3d439b1a2a
("thermal/core: Alloc-copy-free the thermal zone parameters structure") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
This commit is contained in:
parent
404f62cd64
commit
04e6ccfc93
@ -1393,7 +1393,6 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
|
||||
device_del(&tz->device);
|
||||
release_device:
|
||||
put_device(&tz->device);
|
||||
tz = NULL;
|
||||
remove_id:
|
||||
ida_free(&thermal_tz_ida, id);
|
||||
free_tzp:
|
||||
|
Loading…
Reference in New Issue
Block a user