nvme: Don't suspend admin queue that wasn't created
PATCH 1/1 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.
--- drivers/nvme/host/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +6 -1
@@ -1693,7 +1693,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)nvme_suspend_queue (dev->queues[i]);if (csts &NVME_CSTS_CFS || !(csts &NVME_CSTS_RDY )) { -nvme_suspend_queue (dev->queues[0 ]); +/* A device might become IO incapable very soon during +* probe, before the admin queue is configured. Thus, +* queue_count can be 0 here. +*/ +if (dev->queue_count) +nvme_suspend_queue (dev->queues[0 ]); }else {nvme_disable_io_queues (dev);nvme_disable_admin_queue (dev, shutdown);
Signature · 1 line
2.7.4
PATCH 1/1 nvme: Don't suspend admin queue that wasn't created
Quoted 30 lines · Gabriel Krisman Bertazi
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 at linux.vnet.ibm.com>---
?drivers/nvme/host/pci.c | 7 ++++++-
?1 file changed, 6 insertions(+), 1 deletion(-)drivers/nvme/host/pci.c +0
-0@@ -1693,7 +1693,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) ? nvme_suspend_queue(dev->queues[i]);?
? if (csts &NVME_CSTS_CFS|| !(csts &NVME_CSTS_RDY)) {drivers/nvme/host/pci.c +1
-1-nvme_suspend_queue (dev->queues[0 ]); +/* A device might become IO incapable very soon during
drivers/nvme/host/pci.c +1
-0+ ?* probe, before the admin queue is configured.Thus,
drivers/nvme/host/pci.c static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · line 1701
Quoted 4 lines
drivers/nvme/host/pci.c +4
-0+?* queue_count can be 0 here. +?*/ +if (dev->queue_count) +nvme_suspend_queue (dev->queues[0 ]);
Looks like ?a good fix to me.
PATCH 1/1 nvme: Don't suspend admin queue that wasn't created
In reply to Gabriel Krisman BertaziQuoted 11 lines · Gabriel Krisman Bertazi
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 at linux.vnet.ibm.com>
Applied for 4.8, thanks.
Signature · 1 line
Jens Axboe