Skip to content

Commit 9e4e249

Browse files
committed
cpufreq: Reference count policy in cpufreq_update_limits()
Since acpi_processor_notify() can be called before registering a cpufreq driver or even in cases when a cpufreq driver is not registered at all, cpufreq_update_limits() needs to check if a cpufreq driver is present and prevent it from being unregistered. For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq policy pointer for the given CPU and reference count the corresponding policy object, if present. Fixes: 5a25e3f ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates") Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
1 parent 7d20aa5 commit 9e4e249

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,6 +2809,12 @@ EXPORT_SYMBOL(cpufreq_update_policy);
28092809
*/
28102810
void cpufreq_update_limits(unsigned int cpu)
28112811
{
2812+
struct cpufreq_policy *policy __free(put_cpufreq_policy);
2813+
2814+
policy = cpufreq_cpu_get(cpu);
2815+
if (!policy)
2816+
return;
2817+
28122818
if (cpufreq_driver->update_limits)
28132819
cpufreq_driver->update_limits(cpu);
28142820
else

0 commit comments

Comments
 (0)