提交 ee9b8e20 编写于 作者: V Viresh Kumar 提交者: Zheng Zengkai

Revert "cpufreq: Fix possible race in cpufreq online error path"

stable inclusion
from stable-v5.10.121
commit e2786db0a7eb94207a1f7dc1e21f748d5d7bc7a6
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e2786db0a7eb94207a1f7dc1e21f748d5d7bc7a6

--------------------------------

[ Upstream commit 85f0e42b ]

This reverts commit f346e962.

The commit tried to fix a possible real bug but it made it even worse.
The fix was simply buggy as now an error out to out_offline_policy or
out_exit_policy will try to release a semaphore which was never taken in
the first place. This works fine only if we failed late, i.e. via
out_destroy_policy.

Fixes: f346e962 ("cpufreq: Fix possible race in cpufreq online error path")
Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 d5f1b031
...@@ -1515,6 +1515,8 @@ static int cpufreq_online(unsigned int cpu) ...@@ -1515,6 +1515,8 @@ static int cpufreq_online(unsigned int cpu)
for_each_cpu(j, policy->real_cpus) for_each_cpu(j, policy->real_cpus)
remove_cpu_dev_symlink(policy, get_cpu_device(j)); remove_cpu_dev_symlink(policy, get_cpu_device(j));
up_write(&policy->rwsem);
out_offline_policy: out_offline_policy:
if (cpufreq_driver->offline) if (cpufreq_driver->offline)
cpufreq_driver->offline(policy); cpufreq_driver->offline(policy);
...@@ -1523,9 +1525,6 @@ static int cpufreq_online(unsigned int cpu) ...@@ -1523,9 +1525,6 @@ static int cpufreq_online(unsigned int cpu)
if (cpufreq_driver->exit) if (cpufreq_driver->exit)
cpufreq_driver->exit(policy); cpufreq_driver->exit(policy);
cpumask_clear(policy->cpus);
up_write(&policy->rwsem);
out_free_policy: out_free_policy:
cpufreq_policy_free(policy); cpufreq_policy_free(policy);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册