cpufreq: interactive: fix race on governor start/stop
authorLianwei Wang <a22439@motorola.com>
Mon, 7 Jan 2013 06:15:51 +0000 (14:15 +0800)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:52:52 +0000 (13:52 -0800)
commit939e7f1aa6120c60efd45908abfc9cc73850629e
treeecb45356e970e6fa0439e76a4c69c9a6610f9596
parentc7ad1e1b900f63c175f16b503755402c48fef0c6
cpufreq: interactive: fix race on governor start/stop

There is race condition when both two cpu do CPUFREQ_GOV_STOP and one cpu
do CPUFREQ_GOV_START soon. The sysfs_remove_group is not done yet on one
cpu, but sysfs_create_group is called on another cpu, which cause governor
start failed and then kernel panic in timer callback because the policy and
cpu mask are all kfree in cpufreq driver.

Replace atomic with mutex to lock the whole START/STOP sequence.

Change-Id: I3762b3d44315ae021b8275aca84f5ea9147cc540
Signed-off-by: Lianwei Wang <a22439@motorola.com>
drivers/cpufreq/cpufreq_interactive.c