]> www.infradead.org Git - users/jedix/linux-maple.git/commit
thermal: core: Fix race between zone registration and system suspend
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 4 Oct 2024 19:19:21 +0000 (21:19 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 22 Oct 2024 10:07:08 +0000 (12:07 +0200)
commitcdf771ab476bd9acb0948f3088a277d5c3cacc6b
treecb6d911ad24da532226eb643d60c38637f08f4e9
parent7837fa8115e0273d3cfbd3d17b3f7b7291ceac08
thermal: core: Fix race between zone registration and system suspend

If the registration of a thermal zone takes place at the time when
system suspend is started, thermal_pm_notify() can run before the new
thermal zone is added to thermal_tz_list and its "suspended" flag will
not be set.  Consequently, if __thermal_zone_device_update() is called
for that thermal zone, it will not return early as expected which may
cause some destructive interference with the system suspend or resume
flow to occur.

To avoid that, make thermal_zone_init_complete() introduced previously
set the "suspended" flag for new thermal zones if it runs during system
suspend or resume.

Fixes: 4e814173a8c4 ("thermal: core: Fix thermal zone suspend-resume synchronization")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/8490245.NyiUUSuA9g@rjwysocki.net
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
drivers/thermal/thermal_core.c