]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.140/nvme-pci-initialize-queue-memory-before-interrupts.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.140 / nvme-pci-initialize-queue-memory-before-interrupts.patch
1 From 161b8be2bd6abad250d4b3f674bdd5480f15beeb Mon Sep 17 00:00:00 2001
2 From: Keith Busch <keith.busch@intel.com>
3 Date: Thu, 14 Sep 2017 13:54:39 -0400
4 Subject: nvme-pci: initialize queue memory before interrupts
5
6 From: Keith Busch <keith.busch@intel.com>
7
8 commit 161b8be2bd6abad250d4b3f674bdd5480f15beeb upstream.
9
10 A spurious interrupt before the nvme driver has initialized the completion
11 queue may inadvertently cause the driver to believe it has a completion
12 to process. This may result in a NULL dereference since the nvmeq's tags
13 are not set at this point.
14
15 The patch initializes the host's CQ memory so that a spurious interrupt
16 isn't mistaken for a real completion.
17
18 Signed-off-by: Keith Busch <keith.busch@intel.com>
19 Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
20 Signed-off-by: Christoph Hellwig <hch@lst.de>
21 Signed-off-by: Jens Axboe <axboe@kernel.dk>
22 [bwh: Backported to 4.4: adjust context]
23 Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 drivers/nvme/host/pci.c | 4 ++--
27 1 file changed, 2 insertions(+), 2 deletions(-)
28
29 --- a/drivers/nvme/host/pci.c
30 +++ b/drivers/nvme/host/pci.c
31 @@ -1589,11 +1589,11 @@ static int nvme_create_queue(struct nvme
32 if (result < 0)
33 goto release_cq;
34
35 + nvme_init_queue(nvmeq, qid);
36 result = queue_request_irq(dev, nvmeq, nvmeq->irqname);
37 if (result < 0)
38 goto release_sq;
39
40 - nvme_init_queue(nvmeq, qid);
41 return result;
42
43 release_sq:
44 @@ -1797,6 +1797,7 @@ static int nvme_configure_admin_queue(st
45 goto free_nvmeq;
46
47 nvmeq->cq_vector = 0;
48 + nvme_init_queue(nvmeq, 0);
49 result = queue_request_irq(dev, nvmeq, nvmeq->irqname);
50 if (result) {
51 nvmeq->cq_vector = -1;
52 @@ -3165,7 +3166,6 @@ static void nvme_probe_work(struct work_
53 goto disable;
54 }
55
56 - nvme_init_queue(dev->queues[0], 0);
57 result = nvme_alloc_admin_tags(dev);
58 if (result)
59 goto disable;