From: Masayoshi Mizuma Date: Mon, 20 Jun 2016 00:33:17 +0000 (+0900) Subject: nvme: avoid crashes when node 0 is memoryless node. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2fa843512bb5bbc0e876e4f55e22f26a3a8d3edb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Johannes Thumshirn Reviewed-by: Keith Busch Signed-off-by: Jens Axboe --- 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) node = dev_to_node(&pdev->dev); if (node == NUMA_NO_NODE) - set_dev_node(&pdev->dev, 0); + set_dev_node(&pdev->dev, first_memory_node); dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node); if (!dev)