diff options
author | Chuck Ebbert <76306.1226@compuserve.com> | 2006-02-05 02:28:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-05 14:06:53 -0500 |
commit | fe38d8553ccb5237bf0eddda9e94fbca7288551c (patch) | |
tree | 4ebdcf473fcf7e429536e86346c258514671f044 /arch/i386/kernel/cpu/common.c | |
parent | 170aa3d02614ae621d54af10555e2f48977ae8de (diff) |
[PATCH] i386 cpu hotplug: don't access freed memory
i386 CPU init code accesses freed init memory when booting a newly-started
processor after CPU hotplug. The cpu_devs array is searched to find the
vendor and it contains pointers to freed data.
Fix that by:
1. Zeroing entries for freed vendor data after bootup.
2. Changing Transmeta, NSC and UMC to all __init[data].
3. Printing a warning (once only) and setting this_cpu
to a safe default when the vendor is not found.
This does not change behavior for AMD systems. They were broken already
but no error was reported.
Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/cpu/common.c')
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 15aee26ec2b6..7eb9213734a3 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -44,6 +44,7 @@ static void default_init(struct cpuinfo_x86 * c) | |||
44 | 44 | ||
45 | static struct cpu_dev default_cpu = { | 45 | static struct cpu_dev default_cpu = { |
46 | .c_init = default_init, | 46 | .c_init = default_init, |
47 | .c_vendor = "Unknown", | ||
47 | }; | 48 | }; |
48 | static struct cpu_dev * this_cpu = &default_cpu; | 49 | static struct cpu_dev * this_cpu = &default_cpu; |
49 | 50 | ||
@@ -150,6 +151,7 @@ static void __devinit get_cpu_vendor(struct cpuinfo_x86 *c, int early) | |||
150 | { | 151 | { |
151 | char *v = c->x86_vendor_id; | 152 | char *v = c->x86_vendor_id; |
152 | int i; | 153 | int i; |
154 | static int printed; | ||
153 | 155 | ||
154 | for (i = 0; i < X86_VENDOR_NUM; i++) { | 156 | for (i = 0; i < X86_VENDOR_NUM; i++) { |
155 | if (cpu_devs[i]) { | 157 | if (cpu_devs[i]) { |
@@ -159,10 +161,17 @@ static void __devinit get_cpu_vendor(struct cpuinfo_x86 *c, int early) | |||
159 | c->x86_vendor = i; | 161 | c->x86_vendor = i; |
160 | if (!early) | 162 | if (!early) |
161 | this_cpu = cpu_devs[i]; | 163 | this_cpu = cpu_devs[i]; |
162 | break; | 164 | return; |
163 | } | 165 | } |
164 | } | 166 | } |
165 | } | 167 | } |
168 | if (!printed) { | ||
169 | printed++; | ||
170 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); | ||
171 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); | ||
172 | } | ||
173 | c->x86_vendor = X86_VENDOR_UNKNOWN; | ||
174 | this_cpu = &default_cpu; | ||
166 | } | 175 | } |
167 | 176 | ||
168 | 177 | ||