summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2022-11-13 13:24:18 +0200
committerChristoph Hellwig <hch@lst.de>2022-11-16 08:36:36 +0100
commit546dea18c99928bb81392de63092da0e25d07b10 (patch)
tree10888e84671401cdc47c071d523dbc621bccc170
parente8a420efb637f52c586596283d6fd96f2a7ecb5c (diff)
downloadlinux-546dea18c99928bb81392de63092da0e25d07b10.tar.bz2
nvme-auth: check chap ctrl_key once constructed
ctrl ctrl_key member may be overwritten from a sysfs context driven by the user. Once a queue local copy was created, use that instead to minimize checks on a shared resource. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/nvme/host/auth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index d1d89920d03c..781a6003109d 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -333,7 +333,7 @@ static int nvme_auth_process_dhchap_success1(struct nvme_ctrl *ctrl,
struct nvmf_auth_dhchap_success1_data *data = chap->buf;
size_t size = sizeof(*data);
- if (ctrl->ctrl_key)
+ if (chap->ctrl_key)
size += chap->hash_len;
if (size > CHAP_BUF_SIZE) {
@@ -811,7 +811,7 @@ static void nvme_queue_auth_work(struct work_struct *work)
goto fail2;
}
- if (ctrl->ctrl_key) {
+ if (chap->ctrl_key) {
/* DH-HMAC-CHAP Step 5: send success2 */
dev_dbg(ctrl->device, "%s: qid %d send success2\n",
__func__, chap->qid);