[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160114175832.GO18603@e106622-lin>
Date: Thu, 14 Jan 2016 17:58:32 +0000
From: Juri Lelli <juri.lelli@....com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
peterz@...radead.org, rjw@...ysocki.net, mturquette@...libre.com,
steve.muckle@...aro.org, vincent.guittot@...aro.org,
morten.rasmussen@....com, dietmar.eggemann@....com
Subject: Re: [RFC PATCH 12/19] cpufreq: fix locking of policy->rwsem in
cpufreq_init_policy
On 12/01/16 16:09, Viresh Kumar wrote:
> On 11-01-16, 17:35, Juri Lelli wrote:
> > There are paths in cpufreq_init_policy where policy is used, but its rwsem
> > is not held.
> >
> > Fix it.
> >
> > Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
> > Cc: Viresh Kumar <viresh.kumar@...aro.org>
> > Signed-off-by: Juri Lelli <juri.lelli@....com>
> > ---
> > drivers/cpufreq/cpufreq.c | 11 ++++++++---
> > 1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index e7fc5c9..2c7cc6c73 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -998,21 +998,24 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp
> > {
> > int ret = 0;
> >
> > + down_write(&policy->rwsem);
> > +
> > /* Has this CPU been taken care of already? */
> > - if (cpumask_test_cpu(cpu, policy->cpus))
> > + if (cpumask_test_cpu(cpu, policy->cpus)) {
> > + up_write(&policy->rwsem);
>
> Perhaps create a label at the end to unlock the rwsem and jump to it?
>
Yep, done.
Thanks,
- Juri
Powered by blists - more mailing lists