Patch "thermal: core: Fix NULL pointer dereference in zone registration error path" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    thermal: core: Fix NULL pointer dereference in zone registration error path

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     thermal-core-fix-null-pointer-dereference-in-zone-re.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 380be11546799098e47492a5cdd6c79c5dc011b2
Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Date:   Thu Dec 14 11:52:25 2023 +0100

    thermal: core: Fix NULL pointer dereference in zone registration error path
    
    [ Upstream commit 04e6ccfc93c5a1aa1d75a537cf27e418895e20ea ]
    
    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@xxxxxxxxx>
    Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9c17d35ccbbd..1bc7ba459406 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1369,7 +1369,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:




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux