FAILED: patch "[PATCH] thermal: core: Free thermal zone ID later during removal" failed to apply to 6.6-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x daae9c18feec74566e023fc88cfb0ce26e39d868
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026051204-dazzling-those-ecf3@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From daae9c18feec74566e023fc88cfb0ce26e39d868 Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <[email protected]>
Date: Tue, 7 Apr 2026 15:58:34 +0200
Subject: [PATCH] thermal: core: Free thermal zone ID later during removal
The thermal zone removal ordering is different from the thermal zone registration rollback path ordering and the former is arguably problematic because freeing a thermal zone ID prematurely may cause it to be used during the registration of another thermal zone which may fail as a result.
Prevent that from occurring by changing the thermal zone removal ordering to reflect the thermal zone registration rollback path ordering.
Also more the ida_destroy() call from thermal_zone_device_unregister() to thermal_release() for consistency.
drivers/thermal/thermal_core.c +4 -2
@@ -965,6 +965,7 @@ static void thermal_release(struct device *dev) tz =to_thermal_zone (dev);thermal_zone_destroy_device_groups (tz);thermal_set_governor (tz,NULL ); +ida_destroy (&tz->ida);mutex_destroy (&tz->lock);complete (&tz->removal); } else if (!strncmp(dev_name(dev), "cooling_device",
@@ -1729,8 +1730,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)thermal_thresholds_exit (tz);thermal_remove_hwmon_sysfs (tz); -ida_free (&thermal_tz_ida, tz->id); -ida_destroy (&tz->ida);device_del (&tz->device);put_device (&tz->device);
@@ -1738,6 +1737,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)thermal_notify_tz_delete (tz);wait_for_completion (&tz->removal); + +ida_free (&thermal_tz_ida, tz->id); +kfree (tz->tzp);kfree (tz); }
Sasha Levin
maintainerPATCH 1/1 thermal: core: Free thermal zone ID later during removal
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit daae9c18feec74566e023fc88cfb0ce26e39d868 ]
The thermal zone removal ordering is different from the thermal zone registration rollback path ordering and the former is arguably problematic because freeing a thermal zone ID prematurely may cause it to be used during the registration of another thermal zone which may fail as a result.
Prevent that from occurring by changing the thermal zone removal ordering to reflect the thermal zone registration rollback path ordering.
Also more the ida_destroy() call from thermal_zone_device_unregister() to thermal_release() for consistency.
--- drivers/thermal/thermal_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/thermal/thermal_core.c +4 -2
@@ -804,6 +804,7 @@ static void thermal_release(struct device *dev) sizeof("thermal_zone") - 1)) { tz =to_thermal_zone (dev);thermal_zone_destroy_device_groups (tz); +ida_destroy (&tz->ida);mutex_destroy (&tz->lock);complete (&tz->removal); } else if (!strncmp(dev_name(dev), "cooling_device",
@@ -1481,8 +1482,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)thermal_set_governor (tz,NULL );thermal_remove_hwmon_sysfs (tz); -ida_free (&thermal_tz_ida, tz->id); -ida_destroy (&tz->ida);device_del (&tz->device);put_device (&tz->device);
@@ -1490,6 +1489,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)thermal_notify_tz_delete (tz_id);wait_for_completion (&tz->removal); + +ida_free (&thermal_tz_ida, tz->id); +kfree (tz->tzp);kfree (tz); }
Signature · 1 line
2.53.0
Re: [PATCH 6.6.y] thermal: core: Free thermal zone ID later during removal
Quoted 62 lines · Sasha Levin
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit
daae9c18feec74566e023fc88cfb0ce26e39d868]The thermal zone removal ordering is different from the thermal zone registration rollback path ordering and the former is arguably problematic because freeing a thermal zone ID prematurely may cause it to be used during the registration of another thermal zone which may fail as a result.
Prevent that from occurring by changing the thermal zone removal ordering to reflect the thermal zone registration rollback path ordering.
Also more the
ida_destroy()call fromthermal_zone_device_unregister()tothermal_release()for consistency.Fixes b31ef8285b19 ("thermal core: convert ID allocation to IDA")Cc All applicable <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>[ Context ]Signed-off-by Sasha Levin <[email protected]>--- drivers/thermal/thermal_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/thermal/thermal_core.c +4
-2@@ -804,6 +804,7 @@ static void thermal_release(struct device *dev) sizeof("thermal_zone") - 1)) { tz =to_thermal_zone (dev);thermal_zone_destroy_device_groups (tz); +ida_destroy (&tz->ida);mutex_destroy (&tz->lock);complete (&tz->removal); } else if (!strncmp(dev_name(dev), "cooling_device",@@ -1481,8 +1482,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)thermal_set_governor (tz,NULL );thermal_remove_hwmon_sysfs (tz); -ida_free (&thermal_tz_ida, tz->id); -ida_destroy (&tz->ida);device_del (&tz->device);put_device (&tz->device);@@ -1490,6 +1489,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)thermal_notify_tz_delete (tz_id);wait_for_completion (&tz->removal); + +ida_free (&thermal_tz_ida, tz->id); +kfree (tz->tzp);kfree (tz); }Signature · 1 line
2.53.0
Does not apply at all :(