From: Greg KH <greg@kroah.com>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH 6.6.y] thermal: core: Free thermal zone ID later during removal
Date: Fri, 15 May 2026 12:30:57 +0200 [thread overview]
Message-ID: <2026051552-handcuff-immovably-7bf0@gregkh> (raw)
In-Reply-To: <20260514192609.1258270-1-sashal@kernel.org>
On Thu, May 14, 2026 at 03:26:09PM -0400, Sasha Levin wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> [ 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.
>
> Fixes: b31ef8285b19 ("thermal core: convert ID allocation to IDA")
> Cc: All applicable <stable@vger.kernel.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Link: https://patch.msgid.link/5063934.GXAFRqVoOG@rafael.j.wysocki
> [ Context ]
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> drivers/thermal/thermal_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 660a8d6f35673..f8f18c3ebdda4 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -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);
> }
> --
> 2.53.0
>
>
Does not apply at all :(
prev parent reply other threads:[~2026-05-15 10:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 13:49 FAILED: patch "[PATCH] thermal: core: Free thermal zone ID later during removal" failed to apply to 6.6-stable tree gregkh
2026-05-14 19:26 ` [PATCH 6.6.y] thermal: core: Free thermal zone ID later during removal Sasha Levin
2026-05-15 10:30 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026051552-handcuff-immovably-7bf0@gregkh \
--to=greg@kroah.com \
--cc=rafael.j.wysocki@intel.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox