diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-04-07 15:55:19 +0200 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-04-08 12:30:30 +0200 |
| commit | 41ff66baf81c6541f4f985dd7eac4494d03d9440 (patch) | |
| tree | dc944f76a2d37b4d3b23c7c3e2164b2c749b4136 /include/asm-arm/hardware/git@git.tavy.me:linux.git | |
| parent | 761fdf4c8c1c0bd8427f8226be3a3eb5cf896386 (diff) | |
thermal: core: Fix thermal zone governor cleanup issues
If thermal_zone_device_register_with_trips() fails after adding
a thermal governor to the thermal zone being registered, the
governor is not removed from it as appropriate which may lead to
a memory leak.
In turn, thermal_zone_device_unregister() calls thermal_set_governor()
without acquiring the thermal zone lock beforehand which may race with
a governor update via sysfs and may lead to a use-after-free in that
case.
Address these issues by adding two thermal_set_governor() calls, one to
thermal_release() to remove the governor from the given thermal zone,
and one to the thermal zone registration error path to cover failures
preceding the thermal zone device registration.
Fixes: e33df1d2f3a0 ("thermal: let governors have private data for each thermal zone")
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/5092923.31r3eYUQgx@rafael.j.wysocki
Diffstat (limited to 'include/asm-arm/hardware/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
