Skip to content

Commit

Permalink
cpufreq: ondemand:kernel NULL pointer dereference at dbs_check_cpu
Browse files Browse the repository at this point in the history
Function dbs_check_cpu  calls __cpufreq_driver_getavg
With  policy as IN/OUT parameter.
There is possiblity of policy becoming NULL in
 __cpufreq_driver_getavg. Same policy is getting
accessed in the for loop which leads to NULL pointer dereference.
So NULL check is required for the policy

CRs-fixed: 582925
Change-Id: Ib8d8de8d66500430a5aa4c275937640e4f934aa8
Signed-off-by: Swetha Chikkaboraiah <schikk@codeaurora.org>
  • Loading branch information
Swetha Chikkaboraiah authored and intervigilium committed Jan 19, 2014
1 parent 1c3be69 commit 2e6de77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/cpufreq/cpufreq_ondemand.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)

this_dbs_info->freq_lo = 0;
policy = this_dbs_info->cur_policy;
if(policy == NULL)
return;

/*
* Every sampling_rate, we check, if current idle time is less
Expand Down Expand Up @@ -841,6 +843,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
j_dbs_info->max_load = max(cur_load, j_dbs_info->prev_load);
j_dbs_info->prev_load = cur_load;
freq_avg = __cpufreq_driver_getavg(policy, j);
if (policy == NULL)
return;
if (freq_avg <= 0)
freq_avg = policy->cur;

Expand Down

0 comments on commit 2e6de77

Please sign in to comment.