From: Keith Busch Date: Mon, 11 Feb 2019 16:23:50 +0000 (-0700) Subject: nvme-pci: add missing unlock for reset error X-Git-Tag: v4.19.29~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7066774e60e4d2c1108f99822725af5de19f1c78;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 6398ffb..7b9ef8e 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -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); }