Skip to contentSkip to conversation

nvme-pci: Add missing unlock for reset error

PATCH New Keith Busch 2 participants 2 messages Feb 11, 2019 – Feb 12, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-pci: Add missing unlock for reset error

The reset work holds a mutex to prevent races with removal modifying the same resources, but was unlocking only on success. Unlock on failure too.

Fixes 5c959d73dba64 ("nvme-pci: fix rapid add remove sequence")
Signed-off-by Keith Busch <keith.busch at intel.com>

---
My mistake. :(

 drivers/nvme/host/pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/nvme/host/pci.c +5 -3
index 022ea1ee63f8..7fee665ec45e 100644
@@ -2560,15 +2560,15 @@ static void nvme_reset_work(struct work_struct *work)
 	mutex_lock(&dev->shutdown_lock);
 	result = nvme_pci_enable(dev);
 	if (result)
-		goto out;
+		goto out_unlock;
 
 	result = nvme_pci_configure_admin_queue(dev);
 	if (result)
-		goto out;
+		goto out_unlock;
 
 	result = nvme_alloc_admin_tags(dev);
 	if (result)
-		goto out;
+		goto out_unlock;
 
 	/*
 	 * Limit the max command size to prevent iod->sg allocations going
@@ -2651,6 +2651,8 @@ static void nvme_reset_work(struct work_struct *work)
 	nvme_start_ctrl(&dev->ctrl);
 	return;
 
+ out_unlock:
+	mutex_unlock(&dev->shutdown_lock);
  out:
 	nvme_remove_dead_ctrl(dev, result);
 }
Signature · 1 line
2.14.4
#1 lore raw

PATCH 1/1 nvme-pci: Add missing unlock for reset error

Quoted 8 lines · Keith Busch

The reset work holds a mutex to prevent races with removal modifying the same resources, but was unlocking only on success. Unlock on failure too.

Fixes 5c959d73dba64 ("nvme-pci: fix rapid add remove sequence")
Signed-off-by Keith Busch <keith.busch at intel.com>

---
My mistake. :(

Looks sensible to me. Unless I hear complaints I'll merge it later today.