Skip to content

Commit 546dea1

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
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 <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent e8a420e commit 546dea1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/nvme/host/auth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static int nvme_auth_process_dhchap_success1(struct nvme_ctrl *ctrl,
333333
struct nvmf_auth_dhchap_success1_data *data = chap->buf;
334334
size_t size = sizeof(*data);
335335

336-
if (ctrl->ctrl_key)
336+
if (chap->ctrl_key)
337337
size += chap->hash_len;
338338

339339
if (size > CHAP_BUF_SIZE) {
@@ -811,7 +811,7 @@ static void nvme_queue_auth_work(struct work_struct *work)
811811
goto fail2;
812812
}
813813

814-
if (ctrl->ctrl_key) {
814+
if (chap->ctrl_key) {
815815
/* DH-HMAC-CHAP Step 5: send success2 */
816816
dev_dbg(ctrl->device, "%s: qid %d send success2\n",
817817
__func__, chap->qid);

0 commit comments

Comments
 (0)