From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EE303E1701 for ; Tue, 12 May 2026 13:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778593740; cv=none; b=XLu3Eutr1PQ8kOXr6DYG/gS99u2t4h/Hr+v3CDjA2AO8MiDDV2yEmprkXdrPKkCdX6RQfOV0Xg7ngEjnYRl4jov5jL0Eg+ToDrWByWZN2mtngdcMMGMkypNXuFr8r/+QdDN2pGCJj1r5kbT0jwWnooeg+hv4e7kTeyIuMig8MdY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778593740; c=relaxed/simple; bh=IreNZiGPwNb4iFagcwcT6jUreKpFMv3TUr89FJYrc8Y=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=svgCXmINHzFrQDYQx+19ZO+AirCCO1mXwTx3hMEl30OUVNs/rgm50kKJMvABVjkfi0ktpoPusYFfjyMtTM7Pu+kjkxm3XxcyQrZcAE4I4G1EJTGoJaeOK3wEqMFwal308oiYNHDTrXSt85/nyhCFnBF+Sb9yyT922DRQPXQe32Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xdFshKcg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xdFshKcg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5EE9C2BCB0; Tue, 12 May 2026 13:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778593740; bh=IreNZiGPwNb4iFagcwcT6jUreKpFMv3TUr89FJYrc8Y=; h=Subject:To:Cc:From:Date:From; b=xdFshKcgwt96bYzD0j9X4g52G/p6iVhvjYNpXUz9dbM2sqPzTmr5Ve8WsdorJIjKj 0KOn1h3f+MYaKufvbvPL2IYi/dkoMttwfr5//uSOosWsWxmHW57Ss2d4LnXVbECylT wkl77zaHq2KQfOmgvJ1QFvOw6tN0Km+32T/Nn8rw= Subject: FAILED: patch "[PATCH] thermal: core: Free thermal zone ID later during removal" failed to apply to 6.6-stable tree To: rafael.j.wysocki@intel.com,stable@vger.kernel.org Cc: From: Date: Tue, 12 May 2026 15:49:05 +0200 Message-ID: <2026051204-dazzling-those-ecf3@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The 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 . 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 # git commit -s git send-email --to '' --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" 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. Fixes: b31ef8285b19 ("thermal core: convert ID allocation to IDA") Cc: All applicable Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/5063934.GXAFRqVoOG@rafael.j.wysocki diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6e10b2fe2972..c1ec98591703 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -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); }