Skip to content

Commit

Permalink
[PATCH] x86_64: Proper null pointer check in powernow_k8_get
Browse files Browse the repository at this point in the history
This prevents crashes on dual core system when enough ticks are lost.

Replaces earlier patch by me.

Cc: Dave Jones <davej@redhat.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jacob Shin authored and Linus Torvalds committed Apr 9, 2006
1 parent d7fa706 commit 4211a30
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arch/i386/kernel/cpu/cpufreq/powernow-k8.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#define PFX "powernow-k8: "
#define BFX PFX "BIOS error: "
#define VERSION "version 1.60.1"
#define VERSION "version 1.60.2"
#include "powernow-k8.h"

/* serialize freq changes */
Expand Down Expand Up @@ -910,6 +910,9 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
unsigned int newstate;
int ret = -EIO;

if (!data)
return -EINVAL;

/* only run on specific CPU from here on */
oldmask = current->cpus_allowed;
set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
Expand Down Expand Up @@ -969,6 +972,9 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
{
struct powernow_k8_data *data = powernow_data[pol->cpu];

if (!data)
return -EINVAL;

return cpufreq_frequency_table_verify(pol, data->powernow_table);
}

Expand Down Expand Up @@ -1100,6 +1106,9 @@ static unsigned int powernowk8_get (unsigned int cpu)

data = powernow_data[first_cpu(cpu_core_map[cpu])];

if (!data)
return -EINVAL;

if (!data)
return -EINVAL;

Expand Down

0 comments on commit 4211a30

Please sign in to comment.