mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
cpufreq : Fix crash input event handler on governor switch
When an input event and CPU1 hotplug occurs at the same time, a race condition can happen between cpufreq and cpu hotplug resulting in a kernel panic. When a hotplug operation is underway on CPU1, __cpufreq_remove_dev is called. __cpufreq_remove_dev gets the lock, proceeds to free the policy info of the current governor and calls the ondemand governor with a STOP event. If an input event occurs around the same time, it waits for __cpufreq_remove_dev to release the lock. Meanwhile, the ondemand governor clears some of its settings, but fails to clear its local current policy. As soon as the input event handler acquires the lock, it now uses the invalid ondemand current policy handle to make frequency changes. This results in a kernel panic. Skip making frequency changes if this condition happens. CRs-fixed: 327622,319348 Change-Id: I78227352fc66cc3ec5ab095c45eda76a92d1ba46 Signed-off-by: Anitha Anand <anithas@codeaurora.org>
This commit is contained in:
parent
64ea8edaa8
commit
988f1224aa
1 changed files with 3 additions and 0 deletions
|
@ -872,6 +872,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
|
||||||
mutex_lock(&dbs_mutex);
|
mutex_lock(&dbs_mutex);
|
||||||
mutex_destroy(&this_dbs_info->timer_mutex);
|
mutex_destroy(&this_dbs_info->timer_mutex);
|
||||||
dbs_enable--;
|
dbs_enable--;
|
||||||
|
/* If device is being removed, policy is no longer
|
||||||
|
* valid. */
|
||||||
|
this_dbs_info->cur_policy = NULL;
|
||||||
if (!cpu)
|
if (!cpu)
|
||||||
input_unregister_handler(&dbs_input_handler);
|
input_unregister_handler(&dbs_input_handler);
|
||||||
mutex_unlock(&dbs_mutex);
|
mutex_unlock(&dbs_mutex);
|
||||||
|
|
Loading…
Reference in a new issue