提交 6be954d1 编写于 作者: D David John 提交者: Jesse Barnes

PCI: Check the node argument passed to cpumask_of_node

Commit e0cd5160 "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.

Add a check to prevent this.
Signed-off-by: NDavid John <davidjon@xenontk.org>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 46256f83
......@@ -75,7 +75,8 @@ static ssize_t local_cpus_show(struct device *dev,
int len;
#ifdef CONFIG_NUMA
mask = cpumask_of_node(dev_to_node(dev));
mask = (dev_to_node(dev) == -1) ? cpu_online_mask :
cpumask_of_node(dev_to_node(dev));
#else
mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
#endif
......@@ -93,7 +94,8 @@ static ssize_t local_cpulist_show(struct device *dev,
int len;
#ifdef CONFIG_NUMA
mask = cpumask_of_node(dev_to_node(dev));
mask = (dev_to_node(dev) == -1) ? cpu_online_mask :
cpumask_of_node(dev_to_node(dev));
#else
mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册