aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel
diff options
context:
space:
mode:
authorJacob Shin <jacob.shin@amd.com>2006-04-07 13:49:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-09 14:53:51 -0400
commit4211a30349e8d2b724cfb4ce2584604f5e59c299 (patch)
tree59fdb0b812156bbff2266cc51b22d9d608898ecf /arch/i386/kernel
parentd7fa706ce2c29cb751c15ca00f3aa7b223e3c9f0 (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>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c11
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 6ba497c47df6..7c0e160a2145 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -46,7 +46,7 @@
46 46
47#define PFX "powernow-k8: " 47#define PFX "powernow-k8: "
48#define BFX PFX "BIOS error: " 48#define BFX PFX "BIOS error: "
49#define VERSION "version 1.60.1" 49#define VERSION "version 1.60.2"
50#include "powernow-k8.h" 50#include "powernow-k8.h"
51 51
52/* serialize freq changes */ 52/* serialize freq changes */
@@ -910,6 +910,9 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
910 unsigned int newstate; 910 unsigned int newstate;
911 int ret = -EIO; 911 int ret = -EIO;
912 912
913 if (!data)
914 return -EINVAL;
915
913 /* only run on specific CPU from here on */ 916 /* only run on specific CPU from here on */
914 oldmask = current->cpus_allowed; 917 oldmask = current->cpus_allowed;
915 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 918 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
@@ -969,6 +972,9 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
969{ 972{
970 struct powernow_k8_data *data = powernow_data[pol->cpu]; 973 struct powernow_k8_data *data = powernow_data[pol->cpu];
971 974
975 if (!data)
976 return -EINVAL;
977
972 return cpufreq_frequency_table_verify(pol, data->powernow_table); 978 return cpufreq_frequency_table_verify(pol, data->powernow_table);
973} 979}
974 980
@@ -1103,6 +1109,9 @@ static unsigned int powernowk8_get (unsigned int cpu)
1103 if (!data) 1109 if (!data)
1104 return -EINVAL; 1110 return -EINVAL;
1105 1111
1112 if (!data)
1113 return -EINVAL;
1114
1106 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 1115 set_cpus_allowed(current, cpumask_of_cpu(cpu));
1107 if (smp_processor_id() != cpu) { 1116 if (smp_processor_id() != cpu) {
1108 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); 1117 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);