Skip to content

Commit 8e377a1

Browse files
committed
Merge tag 'pm-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix CPU base frequency reporting in the intel_pstate driver and a use-after-free in the scpi-cpufreq driver. Specifics: - Fix the ACPI CPPC library to actually follow the specification when decoding the guaranteed performance register information and make the intel_pstate driver to fall back to the nominal frequency when reporting the base frequency if the guaranteed performance register information is not there (Srinivas Pandruvada). - Fix use-after-free in the exit callback of the scpi-cpufreq left after an update during the 5.0 development cycle (Vincent Stehlé)" * tag 'pm-5.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: scpi: Fix use after free cpufreq: intel_pstate: Also use CPPC nominal_perf for base_frequency ACPI / CPPC: Fix guaranteed performance handling
2 parents 1219530 + 31d4c52 commit 8e377a1

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,13 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
11501150
cpc_read(cpunum, nominal_reg, &nom);
11511151
perf_caps->nominal_perf = nom;
11521152

1153-
cpc_read(cpunum, guaranteed_reg, &guaranteed);
1154-
perf_caps->guaranteed_perf = guaranteed;
1153+
if (guaranteed_reg->type != ACPI_TYPE_BUFFER ||
1154+
IS_NULL_REG(&guaranteed_reg->cpc_entry.reg)) {
1155+
perf_caps->guaranteed_perf = 0;
1156+
} else {
1157+
cpc_read(cpunum, guaranteed_reg, &guaranteed);
1158+
perf_caps->guaranteed_perf = guaranteed;
1159+
}
11551160

11561161
cpc_read(cpunum, lowest_non_linear_reg, &min_nonlinear);
11571162
perf_caps->lowest_nonlinear_perf = min_nonlinear;

drivers/cpufreq/intel_pstate.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ static int intel_pstate_get_cppc_guranteed(int cpu)
385385
if (ret)
386386
return ret;
387387

388-
return cppc_perf.guaranteed_perf;
388+
if (cppc_perf.guaranteed_perf)
389+
return cppc_perf.guaranteed_perf;
390+
391+
return cppc_perf.nominal_perf;
389392
}
390393

391394
#else /* CONFIG_ACPI_CPPC_LIB */

drivers/cpufreq/scpi-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy)
189189

190190
clk_put(priv->clk);
191191
dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
192-
kfree(priv);
193192
dev_pm_opp_remove_all_dynamic(priv->cpu_dev);
193+
kfree(priv);
194194

195195
return 0;
196196
}

0 commit comments

Comments
 (0)