[PATCH 03/10] thermal: int3400: Clean up ODVP attributes after unregistering thermal zone
From: Lee Jones
Date: Thu Dec 03 2026 - 14:56:01 EST
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@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
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