[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1262412947-3890-1-BlackWidow-davidjon@xenontk.org>
Date: Sat, 2 Jan 2010 11:45:47 +0530
From: David John <davidjon@...ontk.org>
To: jbarnes@...tuousgeek.org, rusty@...tcorp.com.au
Cc: andreas.herrmann3@....com, rjw@...k.pl,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] Check the node argument passed to cpumask_of_node
Commit e0cd516 "PCI: derive nearby CPUs from device's instead of bus' NUMA information"
causes an null pointer dereference when reading from the sysfs attributes local_cpu*
on Intel machines with no ACPI NUMA proximity info, since dev->numa_node gets set to -1
for all PCI devices, which then gets passed to cpumask_of_node.
Ensure that the node value is valid.
Signed-off-by: David John <davidjon@...ontk.org>
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index c5087d7..1141a6e 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -99,7 +99,8 @@ extern const struct cpumask *cpumask_of_node(int node);
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
static inline const struct cpumask *cpumask_of_node(int node)
{
- return node_to_cpumask_map[node];
+ return (node < 0 || node >= nr_node_ids) ? cpu_online_mask :
+ node_to_cpumask_map[node];
}
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists