mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
Power management fixes for 7.3-rc3
- Zero-initialize the policy cpumask and initialize the policy rwsem
before exposing the policy sysfs interface (Runyu Xiao and Zhongqiu
Han)
- Fix potential multiplication overflow when calculating freq in OPP
core (Colin Ian King)
- Fix use after free in _update_opp_table_clk() (Peter Griffin)
- Use %pe to print symbolic error name in OPP (Sumeet Pawnikar)
-----BEGIN PGP SIGNATURE-----
iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmqi9w0SHHJqd0Byand5
c29ja2kubmV0AAoJEO5fvZ0v1OO1vIsIAInaslreQyDQzuI0o0eZk/q8WOgCevz1
7LUJ5Uq7rRgyvc0ua2h9jChmjUDPL0qRxWY9UbnflliJt0WoXK7d69MLq3ABnHN9
oduernWbs3qPzqx7f52rIBU3JrmGLdsZSTAtZokPjUqGcuy6y7Z7KML2yheURhL0
yBqTtW3JhoVtDHyuYfdWMRixdjSy6C/UaUmMIo9lR1/yea+PkR+ZNOw7UPzWaMeC
5bdJlV2wsmttNMkfYm70z5biSJVoTqubNnJcTOmLWf2/cYi6OF0wIOV+T4CB/J/C
0QzzJbCW/VCVBVgP32WSIOjkdgMk01oJOHFtKNBQpe+WA+rV4C1RHao=
=KlxA
-----END PGP SIGNATURE-----
Merge tag 'pm-7.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki:
"These harden the cpufreq core against races with sysfs during policy
creation, fix two issues in the OPP (Operating Performance Points)
library, and make OPP print symbolic error names:
- Zero-initialize the policy cpumask and initialize the policy rwsem
before exposing the policy sysfs interface (Runyu Xiao and Zhongqiu
Han)
- Fix potential multiplication overflow when calculating freq in OPP
core (Colin Ian King)
- Fix use after free in _update_opp_table_clk() (Peter Griffin)
- Use %pe to print symbolic error name in OPP (Sumeet Pawnikar)"
* tag 'pm-7.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
opp: fix use after free in _update_opp_table_clk()
cpufreq: zero-initialize policy cpumask before sysfs publication
cpufreq: initialize policy rwsem before sysfs publication
opp: Use %pe to print symbolic error name
OPP: of: Fix potential multiplication overflow when calculating freq
This commit is contained in:
commit
5897d0546f
|
|
@ -1249,7 +1249,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
|||
if (!policy)
|
||||
return NULL;
|
||||
|
||||
if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL))
|
||||
if (!zalloc_cpumask_var(&policy->cpus, GFP_KERNEL))
|
||||
goto err_free_policy;
|
||||
|
||||
if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL))
|
||||
|
|
@ -1258,6 +1258,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
|||
if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL))
|
||||
goto err_free_rcpumask;
|
||||
|
||||
init_rwsem(&policy->rwsem);
|
||||
|
||||
init_completion(&policy->kobj_unregister);
|
||||
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
|
||||
cpufreq_global_kobject, "policy%u", cpu);
|
||||
|
|
@ -1272,8 +1274,6 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
|||
goto err_free_real_cpus;
|
||||
}
|
||||
|
||||
init_rwsem(&policy->rwsem);
|
||||
|
||||
freq_constraints_init(&policy->constraints);
|
||||
|
||||
policy->nb_min.notifier_call = cpufreq_notifier_min;
|
||||
|
|
|
|||
|
|
@ -453,8 +453,8 @@ int dev_pm_opp_get_opp_count(struct device *dev)
|
|||
_find_opp_table(dev);
|
||||
|
||||
if (IS_ERR(opp_table)) {
|
||||
dev_dbg(dev, "%s: OPP table not found (%ld)\n",
|
||||
__func__, PTR_ERR(opp_table));
|
||||
dev_dbg(dev, "%s: OPP table not found (%pe)\n",
|
||||
__func__, opp_table);
|
||||
return PTR_ERR(opp_table);
|
||||
}
|
||||
|
||||
|
|
@ -611,8 +611,8 @@ _find_key(struct device *dev, unsigned long *key, int index, bool available,
|
|||
_find_opp_table(dev);
|
||||
|
||||
if (IS_ERR(opp_table)) {
|
||||
dev_err(dev, "%s: OPP table not found (%ld)\n", __func__,
|
||||
PTR_ERR(opp_table));
|
||||
dev_err(dev, "%s: OPP table not found (%pe)\n", __func__,
|
||||
opp_table);
|
||||
return ERR_CAST(opp_table);
|
||||
}
|
||||
|
||||
|
|
@ -722,8 +722,8 @@ struct dev_pm_opp *dev_pm_opp_find_key_exact(struct device *dev,
|
|||
struct opp_table *opp_table __free(put_opp_table) = _find_opp_table(dev);
|
||||
|
||||
if (IS_ERR(opp_table)) {
|
||||
dev_err(dev, "%s: OPP table not found (%ld)\n", __func__,
|
||||
PTR_ERR(opp_table));
|
||||
dev_err(dev, "%s: OPP table not found (%pe)\n", __func__,
|
||||
opp_table);
|
||||
return ERR_CAST(opp_table);
|
||||
}
|
||||
|
||||
|
|
@ -1036,8 +1036,8 @@ static int _set_opp_voltage(struct device *dev, struct regulator *reg,
|
|||
|
||||
/* Regulator not available for device */
|
||||
if (IS_ERR(reg)) {
|
||||
dev_dbg(dev, "%s: regulator not available: %ld\n", __func__,
|
||||
PTR_ERR(reg));
|
||||
dev_dbg(dev, "%s: regulator not available: %pe\n", __func__,
|
||||
reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1448,8 +1448,8 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
|
|||
temp_freq = freq;
|
||||
opp = _find_freq_ceil(opp_table, &temp_freq);
|
||||
if (IS_ERR(opp)) {
|
||||
dev_err(dev, "%s: failed to find OPP for freq %lu (%ld)\n",
|
||||
__func__, freq, PTR_ERR(opp));
|
||||
dev_err(dev, "%s: failed to find OPP for freq %lu (%pe)\n",
|
||||
__func__, freq, opp);
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
|
||||
|
|
@ -1581,6 +1581,8 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
|
|||
struct opp_table *opp_table,
|
||||
bool getclk)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Return early if we don't need to get clk or we have already done it
|
||||
* earlier.
|
||||
|
|
@ -1607,9 +1609,9 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
|
|||
opp_table->clk = clk_get_optional(dev, NULL);
|
||||
|
||||
if (IS_ERR(opp_table->clk)) {
|
||||
ret = dev_err_probe(dev, PTR_ERR(opp_table->clk), "Couldn't find clock\n");
|
||||
dev_pm_opp_put_opp_table(opp_table);
|
||||
dev_err_probe(dev, PTR_ERR(opp_table->clk), "Couldn't find clock\n");
|
||||
return ERR_CAST(opp_table->clk);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
if (opp_table->clk)
|
||||
|
|
@ -2869,8 +2871,8 @@ static int _opp_set_availability(struct device *dev, unsigned long freq,
|
|||
struct dev_pm_opp *opp __free(put_opp) = ERR_PTR(-ENODEV), *tmp_opp;
|
||||
|
||||
if (IS_ERR(opp_table)) {
|
||||
dev_warn(dev, "%s: Device OPP not found (%ld)\n", __func__,
|
||||
PTR_ERR(opp_table));
|
||||
dev_warn(dev, "%s: Device OPP not found (%pe)\n", __func__,
|
||||
opp_table);
|
||||
return PTR_ERR(opp_table);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1039,7 +1039,7 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
|
|||
|
||||
val = prop->value;
|
||||
while (nr) {
|
||||
unsigned long freq = be32_to_cpup(val++) * 1000;
|
||||
unsigned long freq = (unsigned long)be32_to_cpup(val++) * 1000;
|
||||
unsigned long volt = be32_to_cpup(val++);
|
||||
struct dev_pm_opp_data data = {
|
||||
.freq = freq,
|
||||
|
|
@ -1345,8 +1345,8 @@ int of_get_required_opp_performance_state(struct device_node *np, int index)
|
|||
_find_table_of_opp_np(required_np);
|
||||
|
||||
if (IS_ERR(opp_table)) {
|
||||
pr_err("%s: Failed to find required OPP table %pOF: %ld\n",
|
||||
__func__, np, PTR_ERR(opp_table));
|
||||
pr_err("%s: Failed to find required OPP table %pOF: %pe\n",
|
||||
__func__, np, opp_table);
|
||||
return PTR_ERR(opp_table);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user