Fix oops on non-numa enabled systems

Some systems aren't numa enabled, but still have devices that indicate they
belong to numa node 0 (rather than -1 as they should).  Thats a kernel problem
but we still shouldn't crash as a result (which we will when device get a NULL
numa_node pointer as a result of trying to find non-existant node 0).  This
patch fixes the crash by always returning the unspecified node pointer when numa
is disabled

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Neil Horman 2011-10-20 10:56:48 -04:00
parent 4cdd2040a7
commit effc540808
3 changed files with 5 additions and 1 deletions

View file

@ -281,7 +281,7 @@ struct irq_info *add_misc_irq(int irq)
new->irq = irq;
new->type = IRQ_TYPE_LEGACY;
new->class = IRQ_OTHER;
new->numa_node = get_numa_node(0);
new->numa_node = get_numa_node(-1);
interrupts_db = g_list_append(interrupts_db, new);
return new;
}

View file

@ -49,6 +49,7 @@ extern GList *numa_nodes;
extern GList *packages;
extern GList *cache_domains;
extern GList *cpus;
extern int numa_avail;
enum hp_e {
HINT_POLICY_IGNORE,

3
numa.c
View file

@ -162,6 +162,9 @@ struct topo_obj *get_numa_node(int nodeid)
struct topo_obj find;
GList *entry;
if (!numa_avail)
return &unspecified_node;
if (nodeid == -1)
return &unspecified_node;