Commit 7066774e authored by Keith Busch's avatar Keith Busch Committed by Greg Kroah-Hartman

nvme-pci: add missing unlock for reset error

[ Upstream commit 4726bcf3 ]

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: 5c959d73 ("nvme-pci: fix rapid add remove sequence")
Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6d482bc5
......@@ -2263,15 +2263,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
......@@ -2354,6 +2354,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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment