summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-04-02 15:22:22 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-04-02 15:22:22 -0700
commite0a02923c2cdfc4b8f1ef19181bf40f6529812d3 (patch)
tree1a5e5cc72ab5801db4a40d16106d97e99913ce00
parente69e6e468a5c273132e9f87094fea1c62e347899 (diff)
parent9e4e249018d208678888bdf22f6b652728106528 (diff)
Merge tag 'pm-6.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fix from Rafael Wysocki: "Prevent cpufreq_update_limits() from crashing the kernel due to a NULL pointer dereference when it is called before registering a cpufreq driver, for instance as a result of a notification triggered by the platform firmware (Rafael Wysocki)" * tag 'pm-6.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: Reference count policy in cpufreq_update_limits()
-rw-r--r--drivers/cpufreq/cpufreq.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 0cf5a320bb5e8..3841c9da6cac3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2809,6 +2809,12 @@ EXPORT_SYMBOL(cpufreq_update_policy);
*/
void cpufreq_update_limits(unsigned int cpu)
{
+ struct cpufreq_policy *policy __free(put_cpufreq_policy);
+
+ policy = cpufreq_cpu_get(cpu);
+ if (!policy)
+ return;
+
if (cpufreq_driver->update_limits)
cpufreq_driver->update_limits(cpu);
else