lkml.org 
[lkml]   [2010]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] Check the node argument passed to cpumask_of_node
On Mon,  4 Jan 2010 20:28:57 +0530
David John <davidjon@xenontk.org> wrote:

> 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>
>
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index c5df94e..807224e 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -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
>

Applied to my for-linus branch, thanks David.

--
Jesse Barnes, Intel Open Source Technology Center


\
 
 \ /
  Last update: 2010-01-04 18:21    [W:0.044 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site