mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
cpufreq: unlock when failing cpufreq_update_policy()
commitfefa8ff810upstream. Commitbd0fa9bb45introduced a failure path to cpufreq_update_policy() if cpufreq_driver->get(cpu) returns NULL. However, it jumps to the 'no_policy' label, which exits without unlocking any of the locks the function acquired earlier. This causes later calls into cpufreq to hang. Fix this by creating a new 'unlock' label and jumping to that instead. Fixes:bd0fa9bb45("cpufreq: Return error if ->get() failed in cpufreq_update_policy()") Link: https://devtalk.nvidia.com/default/topic/751903/kernel-3-15-and-nv-drivers-337-340-failed-to-initialize-the-nvidia-kernel-module-gtx-550-ti-/ Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
328484c478
commit
dd0bcbeae6
@@ -2166,10 +2166,8 @@ int cpufreq_update_policy(unsigned int cpu)
|
||||
struct cpufreq_policy new_policy;
|
||||
int ret;
|
||||
|
||||
if (!policy) {
|
||||
ret = -ENODEV;
|
||||
goto no_policy;
|
||||
}
|
||||
if (!policy)
|
||||
return -ENODEV;
|
||||
|
||||
down_write(&policy->rwsem);
|
||||
|
||||
@@ -2188,7 +2186,7 @@ int cpufreq_update_policy(unsigned int cpu)
|
||||
new_policy.cur = cpufreq_driver->get(cpu);
|
||||
if (WARN_ON(!new_policy.cur)) {
|
||||
ret = -EIO;
|
||||
goto no_policy;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
if (!policy->cur) {
|
||||
@@ -2203,10 +2201,10 @@ int cpufreq_update_policy(unsigned int cpu)
|
||||
|
||||
ret = cpufreq_set_policy(policy, &new_policy);
|
||||
|
||||
unlock:
|
||||
up_write(&policy->rwsem);
|
||||
|
||||
cpufreq_cpu_put(policy);
|
||||
no_policy:
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(cpufreq_update_policy);
|
||||
|
||||
Reference in New Issue
Block a user