diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-08-04 22:09:10 +0200 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-08-05 13:25:55 +0200 |
| commit | ff8da20b6f47c48d46e47f93f7a59e2d56ee9107 (patch) | |
| tree | 57e31ad8e8d996622bda563562253e1345490da6 | |
| parent | f93d951ce0d02b5dca01c0c72add411fb17849bb (diff) | |
Revert "thermal/drivers/hwmon: Cleanup coding style a bit"
Revert commit 030a48b0f6ce ("thermal/drivers/hwmon: Cleanup coding style
a bit") that introduced a use-after-free into the error path of
thermal_add_hwmon_sysfs() by removing a valid check from it.
Link: https://lore.kernel.org/linux-hwmon/20260803183915.4ED7D1F000E9@smtp.kernel.org/
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/5123895.31r3eYUQgx@rafael.j.wysocki
| -rw-r--r-- | drivers/thermal/thermal_hwmon.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 597c33c8a555..ec73d03a1e60 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -212,7 +212,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) if (new_hwmon_device) hwmon_device_unregister(hwmon->device); free_mem: - kfree(hwmon); + if (new_hwmon_device) + kfree(hwmon); return result; } |
