All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Matthew Garrett <mjg59@google.com>,
	linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH 03/10] thermal: int3400: Clean up ODVP attributes after unregistering thermal zone
Date: Thu,  3 Dec 2026 19:54:14 +0000	[thread overview]
Message-ID: <20261203195529.3063246-4-lee@kernel.org> (raw)
In-Reply-To: <20261203195529.3063246-1-lee@kernel.org>

int3400_thermal_remove() calls cleanup_odvp() before
thermal_zone_device_unregister().  A concurrent sysfs mode write can
still invoke int3400_thermal_change_mode() -> evaluate_odvp(),
recreating the odvpN sysfs attributes before priv is freed and leaving
dangling attributes that trigger a use-after-free in odvp_show().

Move cleanup_odvp() after thermal_zone_device_unregister(), matching
the probe error path.

Fixes: 006f006f1e5c ("thermal/int340x_thermal: Export OEM vendor variables")
Closes: https://sashiko.dev/#/bug/linux-fb387528-ad8f-418c-b2af-878f7ad81af1
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 5d70301d4a3d..7cd533414973 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -668,8 +668,6 @@ static void int3400_thermal_remove(struct platform_device *pdev)
 			priv->adev->handle, ACPI_DEVICE_NOTIFY,
 			int3400_notify);
 
-	cleanup_odvp(priv);
-
 	if (!priv->rel_misc_dev_res)
 		acpi_thermal_rel_misc_device_remove(priv->adev->handle);
 
@@ -678,6 +676,7 @@ static void int3400_thermal_remove(struct platform_device *pdev)
 	sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
 	sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group);
 	thermal_zone_device_unregister(priv->thermal);
+	cleanup_odvp(priv);
 	kfree(priv->data_vault);
 	kfree(priv->trts);
 	kfree(priv->arts);
-- 
2.56.1.911.g883d8bcb20-goog


  parent reply	other threads:[~2026-12-03 19:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 19:54 [PATCH 00/10] thermal: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03 19:54 ` [PATCH 01/10] thermal: intel: hfi: Pass byte size to alloc_pages_exact() and free_pages_exact() Lee Jones
2026-12-04 20:22   ` Rafael J. Wysocki (Intel)
2026-12-03 19:54 ` [PATCH 02/10] thermal: intel: hfi: Publish hfi_instance only after successful initialisation Lee Jones
2026-12-04 20:29   ` Rafael J. Wysocki (Intel)
2026-12-03 19:54 ` Lee Jones [this message]
2026-12-04 20:24   ` [PATCH 03/10] thermal: int3400: Clean up ODVP attributes after unregistering thermal zone Rafael J. Wysocki (Intel)
2026-12-03 19:54 ` [PATCH 04/10] thermal/drivers/qcom/tsens-v1: Validate sensor count before legacy calibration Lee Jones
2026-12-03 19:54 ` [PATCH 05/10] thermal/drivers/qcom/tsens: Bound sensor initialisation by num_sensors Lee Jones
2026-12-03 19:54 ` [PATCH 06/10] thermal/drivers/rcar: Free IRQs before cancelling delayed work on remove Lee Jones
2026-12-04 17:15   ` Niklas Söderlund
2026-12-05  5:38     ` Yaohan Li
2026-12-03 19:54 ` [PATCH 07/10] thermal/drivers/imx91: Acquire runtime PM reference in imx91_tmu_get_temp() Lee Jones
2026-12-03 20:11   ` sashiko-bot
2026-12-03 20:34     ` Frank Li
2026-12-04 10:40   ` Peng Fan (OSS)
2026-12-03 19:54 ` [PATCH 08/10] tools/thermal/tmon: Open log file with O_NOFOLLOW before validating and truncating Lee Jones
2026-12-04 20:34   ` Rafael J. Wysocki (Intel)
2026-12-03 19:54 ` [PATCH 09/10] thermal/drivers/qcom/tsens: Drop __init from ops init callbacks Lee Jones
2026-12-03 19:54 ` [PATCH 10/10] thermal/drivers/imx91: Use pm_runtime_resume_and_get() in imx91_tmu_change_mode() Lee Jones
2026-12-03 20:21   ` Frank Li
2026-12-04 10:40   ` Peng Fan (OSS)

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=20261203195529.3063246-4-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mjg59@google.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.