lkml.org 
[lkml]   [2016]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC PATCH 08/19] cpufreq: fix warning for cpufreq_init_policy unlocked access to cpufreq_governor_list
    On 12/01/16 15:39, Viresh Kumar wrote:
    > 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.
    >

    Other users (i.e., cpufreq_parse_governor and cpufreq_register_governor)
    needs to take the mutex externally. So, we need to unify this behaviour.

    Best,

    - Juri

    > > 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
    >

    \
     
     \ /
      Last update: 2016-01-12 17:21    [W:4.698 / U:0.156 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site