nvme-auth: don't re-authenticate if the controller is not LIVE
authorSagi Grimberg <sagi@grimberg.me>
Sun, 13 Nov 2022 11:24:08 +0000 (13:24 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 16 Nov 2022 07:36:34 +0000 (08:36 +0100)
The connect sequence will re-authenticate.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/auth.c

index 2f823c6b84fd3fc38680734fe593e4fef92d7a66..4f2c8d0567bdec295b8020bb7b76cfbf67c122a3 100644 (file)
@@ -939,6 +939,13 @@ static void nvme_ctrl_auth_work(struct work_struct *work)
                container_of(work, struct nvme_ctrl, dhchap_auth_work);
        int ret, q;
 
+       /*
+        * If the ctrl is no connected, bail as reconnect will handle
+        * authentication.
+        */
+       if (ctrl->state != NVME_CTRL_LIVE)
+               return;
+
        /* Authenticate admin queue first */
        ret = nvme_auth_negotiate(ctrl, 0);
        if (ret) {