diff options
author | Jacob Shin <jacob.shin@amd.com> | 2006-04-07 19:49:51 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-09 11:53:51 -0700 |
commit | 4211a30349e8d2b724cfb4ce2584604f5e59c299 (patch) | |
tree | 59fdb0b812156bbff2266cc51b22d9d608898ecf | |
parent | d7fa706ce2c29cb751c15ca00f3aa7b223e3c9f0 (diff) |
[PATCH] x86_64: Proper null pointer check in powernow_k8_get
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>
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 6ba497c47df..7c0e160a214 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c @@ -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 */ @@ -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)); @@ -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); } @@ -1103,6 +1109,9 @@ static unsigned int powernowk8_get (unsigned int cpu) if (!data) return -EINVAL; + if (!data) + return -EINVAL; + set_cpus_allowed(current, cpumask_of_cpu(cpu)); if (smp_processor_id() != cpu) { printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); |