aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/pci.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>2016-09-06 16:39:13 -0400
committerJens Axboe <axboe@fb.com>2016-09-07 10:53:21 -0400
commit82469c59d222f839ded5cd282172258e026f9112 (patch)
treeafa8c5ae402d70b803373656b6afa069b93bea69 /drivers/nvme/host/pci.c
parentc6935931c1894ff857616ff8549b61236a19148f (diff)
nvme: Don't suspend admin queue that wasn't created
This fixes a regression in my previous commit c21377f8366c ("nvme: Suspend all queues before deletion"), which provoked an Oops in the removal path when removing a device that became IO incapable very early at probe (i.e. after a failed EEH recovery). Turns out, if the error occurred very early at the probe path, before even configuring the admin queue, we might try to suspend the uninitialized admin queue, accessing bad memory. Fixes: c21377f8366c ("nvme: Suspend all queues before deletion") Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/host/pci.c')
-rw-r--r--drivers/nvme/host/pci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8dcf5a960951..be84a84a40f7 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1693,7 +1693,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
1693 nvme_suspend_queue(dev->queues[i]); 1693 nvme_suspend_queue(dev->queues[i]);
1694 1694
1695 if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { 1695 if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) {
1696 nvme_suspend_queue(dev->queues[0]); 1696 /* A device might become IO incapable very soon during
1697 * probe, before the admin queue is configured. Thus,
1698 * queue_count can be 0 here.
1699 */
1700 if (dev->queue_count)
1701 nvme_suspend_queue(dev->queues[0]);
1697 } else { 1702 } else {
1698 nvme_disable_io_queues(dev); 1703 nvme_disable_io_queues(dev);
1699 nvme_disable_admin_queue(dev, shutdown); 1704 nvme_disable_admin_queue(dev, shutdown);