Skip to content

Commit

Permalink
PCI: Check the node argument passed to cpumask_of_node
Browse files Browse the repository at this point in the history
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.

Add a check to prevent this.

Signed-off-by: David John <davidjon@xenontk.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
David John authored and Jesse Barnes committed Jan 4, 2010
1 parent 46256f8 commit 6be954d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/pci/pci-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6be954d

Please sign in to comment.