]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpufreq: intel_pstate: Fix object lifecycle issue in update_qos_request()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 5 Sep 2025 13:52:03 +0000 (15:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:23:12 +0000 (16:23 +0200)
commit0a58d3e77b22b087a57831c87cafd360e144a5bd
tree72e32be2d97948a00eff26ba2ddf0182fe9fa287
parent7204b0f8f665df9685409d8c8ab26cb4d7e49c3a
cpufreq: intel_pstate: Fix object lifecycle issue in update_qos_request()

commit 69e5d50fcf4093fb3f9f41c4f931f12c2ca8c467 upstream.

The cpufreq_cpu_put() call in update_qos_request() takes place too early
because the latter subsequently calls freq_qos_update_request() that
indirectly accesses the policy object in question through the QoS request
object passed to it.

Fortunately, update_qos_request() is called under intel_pstate_driver_lock,
so this issue does not matter for changing the intel_pstate operation
mode, but it theoretically can cause a crash to occur on CPU device hot
removal (which currently can only happen in virt, but it is formally
supported nevertheless).

Address this issue by modifying update_qos_request() to drop the
reference to the policy later.

Fixes: da5c504c7aae ("cpufreq: intel_pstate: Implement QoS supported freq constraints")
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
Link: https://patch.msgid.link/2255671.irdbgypaU6@rafael.j.wysocki
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/intel_pstate.c