From 2ef52590fed50f3eb4142e6690322b93558eeb65 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 5 Jul 2018 18:59:55 +0200 Subject: [PATCH] 4.4-stable patches added patches: nvme-pci-initialize-queue-memory-before-interrupts.patch --- ...alize-queue-memory-before-interrupts.patch | 59 +++++++++++++++++++ queue-4.4/series | 1 + 2 files changed, 60 insertions(+) create mode 100644 queue-4.4/nvme-pci-initialize-queue-memory-before-interrupts.patch diff --git a/queue-4.4/nvme-pci-initialize-queue-memory-before-interrupts.patch b/queue-4.4/nvme-pci-initialize-queue-memory-before-interrupts.patch new file mode 100644 index 00000000000..d563a2e8213 --- /dev/null +++ b/queue-4.4/nvme-pci-initialize-queue-memory-before-interrupts.patch @@ -0,0 +1,59 @@ +From 161b8be2bd6abad250d4b3f674bdd5480f15beeb Mon Sep 17 00:00:00 2001 +From: Keith Busch +Date: Thu, 14 Sep 2017 13:54:39 -0400 +Subject: nvme-pci: initialize queue memory before interrupts + +From: Keith Busch + +commit 161b8be2bd6abad250d4b3f674bdd5480f15beeb upstream. + +A spurious interrupt before the nvme driver has initialized the completion +queue may inadvertently cause the driver to believe it has a completion +to process. This may result in a NULL dereference since the nvmeq's tags +are not set at this point. + +The patch initializes the host's CQ memory so that a spurious interrupt +isn't mistaken for a real completion. + +Signed-off-by: Keith Busch +Reviewed-by: Johannes Thumshirn +Signed-off-by: Christoph Hellwig +Signed-off-by: Jens Axboe +[bwh: Backported to 4.4: adjust context] +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvme/host/pci.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -1589,11 +1589,11 @@ static int nvme_create_queue(struct nvme + if (result < 0) + goto release_cq; + ++ nvme_init_queue(nvmeq, qid); + result = queue_request_irq(dev, nvmeq, nvmeq->irqname); + if (result < 0) + goto release_sq; + +- nvme_init_queue(nvmeq, qid); + return result; + + release_sq: +@@ -1797,6 +1797,7 @@ static int nvme_configure_admin_queue(st + goto free_nvmeq; + + nvmeq->cq_vector = 0; ++ nvme_init_queue(nvmeq, 0); + result = queue_request_irq(dev, nvmeq, nvmeq->irqname); + if (result) { + nvmeq->cq_vector = -1; +@@ -3165,7 +3166,6 @@ static void nvme_probe_work(struct work_ + goto disable; + } + +- nvme_init_queue(dev->queues[0], 0); + result = nvme_alloc_admin_tags(dev); + if (result) + goto disable; diff --git a/queue-4.4/series b/queue-4.4/series index dd83658af19..4dcdc495e34 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -9,3 +9,4 @@ ath10k-fix-rfc1042-header-retrieval-in-qca4019-with-eth-decap-mode.patch i2c-rcar-fix-resume-by-always-initializing-registers-before-transfer.patch ipv4-fix-error-return-value-in-fib_convert_metrics.patch kprobes-x86-do-not-modify-singlestep-buffer-while-resuming.patch +nvme-pci-initialize-queue-memory-before-interrupts.patch -- 2.47.3