[PATCH v7 11/14] nvme-auth: wait for authentication to finish when changing keys
From: Hannes Reinecke
Date: Thu Nov 26 2026 - 09:14:05 EST
When changing DH-HMAC-CHAP keys in sysfs we need to wait for authentication
to complete on all queues. Otherwise the user might change the keys while
authentication is in progress, causing the authentication to fail and
I/O to be interrupted.
Signed-off-by: Hannes Reinecke <hare@xxxxxxxxxx>
Reviewed-by: Sagi Grimberg <sagi@xxxxxxxxxxx>
---
drivers/nvme/host/sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index ab912a4b281c717ca569062c19850d305f20500d..4ebc03a8ddcaede1344988dfe816bbaf3746bb55 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -908,7 +908,7 @@ static ssize_t dhchap_secret_store(struct device *dev,
/* Start re-authentication */
dev_info(ctrl->device, "re-authenticating controller\n");
queue_work(nvme_wq, &ctrl->dhchap_auth_work);
-
+ flush_work(&ctrl->dhchap_auth_work);
return count;
}
@@ -1005,7 +1005,7 @@ static ssize_t dhchap_ctrl_secret_store(struct device *dev,
/* Start re-authentication */
dev_info(ctrl->device, "re-authenticating controller\n");
queue_work(nvme_wq, &ctrl->dhchap_auth_work);
-
+ flush_work(&ctrl->dhchap_auth_work);
return count;
}
--
2.51.0