]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvme-pci: Skip queue deletion if there are no queues
authorKeith Busch <keith.busch@intel.com>
Thu, 12 Apr 2018 15:16:08 +0000 (09:16 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 12 Apr 2018 15:58:27 +0000 (09:58 -0600)
User reported controller always retains CSTS.RDY to 1, which fails
controller disabling when resetting the controller. This is also before
the admin queue is allocated, and trying to disable an unallocated queue
results in a NULL dereference.

Reported-by: Alex Gagniuc <Alex_Gagniuc@Dellteam.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/pci.c

index 295fbec1e5f2d4b88ae1ee3cbc63e61a9da76bc4..22403aa7dc60db0e7901c5bc2ef8980e3c9823de 100644 (file)
@@ -2201,7 +2201,7 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
 
        nvme_stop_queues(&dev->ctrl);
 
-       if (!dead) {
+       if (!dead && dev->ctrl.queue_count > 0) {
                /*
                 * If the controller is still alive tell it to stop using the
                 * host memory buffer.  In theory the shutdown / reset should