Skip to contentSkip to conversation

i386 cpu hotplug: don't access freed memory

PATCH Chuck Ebbert 1 participant 1 message Feb 3, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 13 lines · Andrew Morton
Quoted 12 lines · Chuck Ebbert
(quoted diff) +3 -1
@@ -160,10 +162,17 @@ static void __cpuinit get_cpu_vendor(str
                            c->x86_vendor = i;
                            if (!early)
                                    this_cpu = cpu_devs[i];
-                           break;
+                           return;
                    }
            }
    }
+   if (!printed) {
+           printed++;
Quoted 8 lines

Review static void __cpuinit get_cpu_vendor(str · line 175

Quoted 5 lines
(quoted diff) +5 -0
+           printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n");
+           printk(KERN_ERR "CPU: Your system may be unstable.\n");
+   }
+   c->x86_vendor = X86_VENDOR_UNKNOWN;
+   this_cpu = &default_cpu;

Well that's a worry. Under what circumstances (if any) will this final bit of code get executed?

It should happen when someone hotplugs a CPU on an AMD SMP machine. But it was already broken in that case.

So now we have to decide whether to make the AMD code __cpuinit instead of __init and keep it around for hotplug. I can't test that so I didn't try it.

Signature · 1 line
Chuck