diff options
author | Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> | 2016-06-19 20:33:17 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-07-13 12:17:55 -0400 |
commit | 2fa843512bb5bbc0e876e4f55e22f26a3a8d3edb (patch) | |
tree | b67ab35ae369935c62c0b4d120af3f3e6de8dd25 | |
parent | f80ec966c19b78af4360e26e32e1ab775253105f (diff) |
nvme: avoid crashes when node 0 is memoryless node.
When CONFIG_NUMA is enabled and node 0 is memoryless, the system
crashes because nvme_probe() sets the device->numa_node to 0 by
set_dev_node(&pdev->dev, 0), so it tries to allocate memory from node 0.
To avoid the crash, we should change the 0 to first_memory_node.
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/host/pci.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 120f9b8c926e..8083ae8ec96d 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1918,7 +1918,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1918 | 1918 | ||
1919 | node = dev_to_node(&pdev->dev); | 1919 | node = dev_to_node(&pdev->dev); |
1920 | if (node == NUMA_NO_NODE) | 1920 | if (node == NUMA_NO_NODE) |
1921 | set_dev_node(&pdev->dev, 0); | 1921 | set_dev_node(&pdev->dev, first_memory_node); |
1922 | 1922 | ||
1923 | dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node); | 1923 | dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node); |
1924 | if (!dev) | 1924 | if (!dev) |