[PATCH 3.14 84/84] NVMe: Initialize device reference count earlier

From: Greg Kroah-Hartman
Date: Tue Sep 29 2015 - 11:29:26 EST


3.14-stable review patch. If anyone has any objections, please let me know.

------------------

From: Keith Busch <keith.busch@xxxxxxxxx>

commit fb35e914b3f88cda9ee6f9d776910c35269c4ecf upstream.

If an NVMe device becomes ready but fails to create IO queues, the driver
creates a character device handle so the device can be managed. The
device reference count needs to be initialized before creating the
character device.

Signed-off-by: Keith Busch <keith.busch@xxxxxxxxx>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/block/nvme-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2464,6 +2464,7 @@ static int nvme_probe(struct pci_dev *pd
if (result)
goto release;

+ kref_init(&dev->kref);
result = nvme_dev_start(dev);
if (result) {
if (result == -EBUSY)
@@ -2471,7 +2472,6 @@ static int nvme_probe(struct pci_dev *pd
goto release_pools;
}

- kref_init(&dev->kref);
result = nvme_dev_add(dev);
if (result)
goto shutdown;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/