Commit 924383ed authored by Henry Willard's avatar Henry Willard Committed by Greg Kroah-Hartman

cpufreq: governor: Avoid accessing invalid governor_data

commit 2a3eb51e upstream.

If cppc_cpufreq.ko is deleted at the same time that tuned-adm is
changing profiles, there is a small chance that a race can occur
between cpufreq_dbs_governor_exit() and cpufreq_dbs_governor_limits()
resulting in a system failure when the latter tries to use
policy->governor_data that has been freed by the former.

This patch uses gov_dbs_data_mutex to synchronize access.

Fixes: e788892b (cpufreq: governor: Get rid of governor events)
Signed-off-by: default avatarHenry Willard <>
[ rjw: Subject, minor white space adjustment ]
Cc: 4.8+ <> # 4.8+
Signed-off-by: default avatarRafael J. Wysocki <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 256f63f5
......@@ -555,12 +555,20 @@ EXPORT_SYMBOL_GPL(cpufreq_dbs_governor_stop);
void cpufreq_dbs_governor_limits(struct cpufreq_policy *policy)
struct policy_dbs_info *policy_dbs = policy->governor_data;
struct policy_dbs_info *policy_dbs;
/* Protect gov->gdbs_data against cpufreq_dbs_governor_exit() */
policy_dbs = policy->governor_data;
if (!policy_dbs)
goto out;
gov_update_sample_delay(policy_dbs, 0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment