From: chenqiwu Date: Mon, 20 Jan 2020 07:41:28 +0000 (+0800) Subject: cpufreq: brcmstb-avs: fix imbalance of cpufreq policy refcount X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a48ac1c9f294e1a9b692d9458de6e6b58da8b07d;p=linux.git cpufreq: brcmstb-avs: fix imbalance of cpufreq policy refcount brcm_avs_cpufreq_get() calls cpufreq_cpu_get() to get the cpufreq policy, meanwhile, it also increments the kobject reference count to mark it busy. However, a corresponding call of cpufreq_cpu_put() is ignored to decrement the kobject reference count back, which may lead to a potential stuck risk that the cpuhp thread deadly waits for dropping of kobject refcount when cpufreq policy free. With this patch, the cpuhp thread can be easily exercised by attempting to force an unbind of the CPUfreq driver. Signed-off-by: chenqiwu [ Viresh: Dropped !policy check ] Signed-off-by: Viresh Kumar --- diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c index 77b0e5d0fb134..4f86ce2db34fb 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c @@ -455,6 +455,8 @@ static unsigned int brcm_avs_cpufreq_get(unsigned int cpu) struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); struct private_data *priv = policy->driver_data; + cpufreq_cpu_put(policy); + return brcm_avs_get_frequency(priv->base); }