From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934819AbcALKJy (ORCPT ); Tue, 12 Jan 2016 05:09:54 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:32999 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761893AbcALKJt (ORCPT ); Tue, 12 Jan 2016 05:09:49 -0500 Date: Tue, 12 Jan 2016 15:39:45 +0530 From: Viresh Kumar To: Juri Lelli Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, peterz@infradead.org, rjw@rjwysocki.net, mturquette@baylibre.com, steve.muckle@linaro.org, vincent.guittot@linaro.org, morten.rasmussen@arm.com, dietmar.eggemann@arm.com Subject: Re: [RFC PATCH 08/19] cpufreq: fix warning for cpufreq_init_policy unlocked access to cpufreq_governor_list Message-ID: <20160112100945.GZ1084@ubuntu> References: <1452533760-13787-1-git-send-email-juri.lelli@arm.com> <1452533760-13787-9-git-send-email-juri.lelli@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452533760-13787-9-git-send-email-juri.lelli@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11-01-16, 17:35, Juri Lelli wrote: > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 7dae7f3..d065435 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -969,6 +969,7 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) > > memcpy(&new_policy, policy, sizeof(*policy)); > > + mutex_lock(&cpufreq_governor_mutex); > /* Update governor of new_policy to the governor used before hotplug */ > gov = find_governor(policy->last_governor); You should take the lock within find_governor() instead, i.e. around the while loop. > if (gov) > @@ -976,6 +977,7 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) > policy->governor->name, policy->cpu); > else > gov = CPUFREQ_DEFAULT_GOVERNOR; > + mutex_unlock(&cpufreq_governor_mutex); > > new_policy.governor = gov; > > -- > 2.2.2 -- viresh