diff options
author | Keith Busch <keith.busch@intel.com> | 2019-02-11 09:23:50 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-13 14:04:17 -0700 |
commit | 365e2f3a358a42c362177564d58433718cf58cda (patch) | |
tree | 73d828392bb8209b5e1a62f4b97ec1a73c425b8f | |
parent | beed6109acd4efc2f1717c31bddcd0ad7ebbf253 (diff) | |
download | linux-stable-365e2f3a358a42c362177564d58433718cf58cda.tar.gz linux-stable-365e2f3a358a42c362177564d58433718cf58cda.tar.bz2 linux-stable-365e2f3a358a42c362177564d58433718cf58cda.zip |
nvme-pci: add missing unlock for reset error
[ Upstream commit 4726bcf30fad37cc555cd9dcd6c73f2b2668c879 ]
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@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/nvme/host/pci.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 439b9f4eb246..5c58e0ffa3ac 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2283,15 +2283,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 @@ -2374,6 +2374,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); } |