Commit d22fe808 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Do more checking in the SRAT header code

 - Check if the processor/memory affinity entries are long enough
   according to the ACPI 3.0 spec.
 - Ignore memory affinity entries that define a zero length region.

All based on BIOS issues found in the field @)
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7ded5689
...@@ -135,7 +135,12 @@ void __init ...@@ -135,7 +135,12 @@ void __init
acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
{ {
int pxm, node; int pxm, node;
if (srat_disabled() || pa->flags.enabled == 0) if (srat_disabled())
return;
if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) { bad_srat();
return;
}
if (pa->flags.enabled == 0)
return; return;
pxm = pa->proximity_domain; pxm = pa->proximity_domain;
node = setup_node(pxm); node = setup_node(pxm);
...@@ -159,8 +164,16 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) ...@@ -159,8 +164,16 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
int node, pxm; int node, pxm;
int i; int i;
if (srat_disabled() || ma->flags.enabled == 0) if (srat_disabled())
return; return;
if (ma->header.length != sizeof(struct acpi_table_memory_affinity)) {
bad_srat();
return;
}
if (ma->flags.enabled == 0)
return;
start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
pxm = ma->proximity_domain; pxm = ma->proximity_domain;
node = setup_node(pxm); node = setup_node(pxm);
if (node < 0) { if (node < 0) {
...@@ -168,8 +181,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) ...@@ -168,8 +181,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
bad_srat(); bad_srat();
return; return;
} }
start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
/* It is fine to add this area to the nodes data it will be used later*/ /* It is fine to add this area to the nodes data it will be used later*/
if (ma->flags.hot_pluggable == 1) if (ma->flags.hot_pluggable == 1)
printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n", printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment