Re: [PATCH] x86, mce: Don't initialize MCEs on unknown CPUs

From: Andi Kleen
Date: Mon Aug 17 2009 - 07:36:26 EST


Ingo Molnar wrote:


btw., i found the bug - it's due to:

# CONFIG_CPU_SUP_INTEL is not set

Ah, thanks for debugging. Very tricky and nasty. Perhaps these options are more trouble
than what they save in code.

static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c)
@@ -1342,11 +1352,10 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
if (!mce_available(c))
return;
- if (mce_cap_init() < 0) {
+ if (mce_cap_init() < 0 || mce_cpu_quirks(c) < 0) {
mce_disabled = 1;
return;
}
- mce_cpu_quirks(c);

I'm very pedantic here and it's more a theoretical problem, but mce_cap_init() allocates
memory which you leak and this could rerun on each CPU hotplug. So if you have a unknown CPU and do
a lot of CPU hotadds in a loop then you would eventually fill all memory.
Better kfree() the bank arrays.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/