From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: David John <davidjon@xenontk.org>
Cc: rusty@rustcorp.com.au, andreas.herrmann3@amd.com, rjw@sisk.pl,
jin.dongming@np.css.fujitsu.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Check the node argument passed to cpumask_of_node
Date: Mon, 4 Jan 2010 09:18:49 -0800 [thread overview]
Message-ID: <20100104091849.58d85bae@jbarnes-piketon> (raw)
In-Reply-To: <1262617137-3321-1-BlackWidow-davidjon@xenontk.org>
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
next prev parent reply other threads:[~2010-01-04 17:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-01 19:50 [Regression] 2.6.33-rc2 - pci: Commit e0cd516 causes OOPS David John
2010-01-01 19:55 ` [PATCH] Check the node argument passed to cpumask_of_node David John
2010-01-01 21:55 ` [Regression] 2.6.33-rc2 - pci: Commit e0cd516 causes OOPS Rafael J. Wysocki
2010-01-02 6:15 ` [PATCH v2] Check the node argument passed to cpumask_of_node David John
2010-01-04 4:28 ` Rusty Russell
2010-01-04 11:42 ` David John
2010-01-04 14:58 ` [PATCH v3] " David John
2010-01-04 17:18 ` Jesse Barnes [this message]
2010-01-04 5:15 ` [PATCH v2] " Jin Dongming
2010-01-01 22:22 ` [Regression] 2.6.33-rc2 - pci: Commit e0cd516 causes OOPS Yinghai Lu
2010-01-02 6:18 ` David John
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100104091849.58d85bae@jbarnes-piketon \
--to=jbarnes@virtuousgeek.org \
--cc=andreas.herrmann3@amd.com \
--cc=davidjon@xenontk.org \
--cc=jin.dongming@np.css.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome