nvme-auth: unlock mutex in one place only
authorMark O'Donovan <shiftee@posteo.net>
Wed, 11 Oct 2023 08:45:11 +0000 (08:45 +0000)
committerKeith Busch <kbusch@kernel.org>
Mon, 20 Nov 2023 17:25:13 +0000 (09:25 -0800)
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/auth.c

index 48328e36e93bc423974f5089a4ee5fd0bbcc9a6d..0f5ea63d3c8d2e46a470ebfa3782ada75bd92874 100644 (file)
@@ -757,12 +757,11 @@ static void nvme_queue_auth_work(struct work_struct *work)
                __func__, chap->qid);
        mutex_lock(&ctrl->dhchap_auth_mutex);
        ret = nvme_auth_dhchap_setup_host_response(ctrl, chap);
+       mutex_unlock(&ctrl->dhchap_auth_mutex);
        if (ret) {
-               mutex_unlock(&ctrl->dhchap_auth_mutex);
                chap->error = ret;
                goto fail2;
        }
-       mutex_unlock(&ctrl->dhchap_auth_mutex);
 
        /* DH-HMAC-CHAP Step 3: send reply */
        dev_dbg(ctrl->device, "%s: qid %d send reply\n",