Skip to content

Commit 4726bcf

Browse files
Keith BuschChristoph Hellwig
authored andcommitted
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: 5c959d7 ("nvme-pci: fix rapid add remove sequence") Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent aef1897 commit 4726bcf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/nvme/host/pci.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,15 +2560,15 @@ static void nvme_reset_work(struct work_struct *work)
25602560
mutex_lock(&dev->shutdown_lock);
25612561
result = nvme_pci_enable(dev);
25622562
if (result)
2563-
goto out;
2563+
goto out_unlock;
25642564

25652565
result = nvme_pci_configure_admin_queue(dev);
25662566
if (result)
2567-
goto out;
2567+
goto out_unlock;
25682568

25692569
result = nvme_alloc_admin_tags(dev);
25702570
if (result)
2571-
goto out;
2571+
goto out_unlock;
25722572

25732573
/*
25742574
* Limit the max command size to prevent iod->sg allocations going
@@ -2651,6 +2651,8 @@ static void nvme_reset_work(struct work_struct *work)
26512651
nvme_start_ctrl(&dev->ctrl);
26522652
return;
26532653

2654+
out_unlock:
2655+
mutex_unlock(&dev->shutdown_lock);
26542656
out:
26552657
nvme_remove_dead_ctrl(dev, result);
26562658
}

0 commit comments

Comments
 (0)