Skip to contentSkip to conversation

nvme-auth: unlock mutex in one place only

PATCH RESEND Applied Mark O'Donovan 3 participants 5 messages Oct 11, 2023 – Nov 20, 2023

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 nvme-auth: unlock mutex in one place only

---
 drivers/nvme/host/auth.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/nvme/host/auth.c +1 -2
index daf5d144a8ea..e1a98647c3a2 100644
@@ -758,12 +758,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",
Signature · 1 line
2.39.2
#1 lore raw

PATCH RESEND 2/2 nvme-auth: set explanation code for failure2 msgs

Some error cases were not setting an auth-failure-reason-code-explanation. This means an AUTH_Failure2 message will be sent with an explanation value of 0 which is a reserved value.

---
v1->v2: Set failure explanation in a single place if the error handling code has not already done so.

---
 drivers/nvme/host/auth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/nvme/host/auth.c +2 -0
index e1a98647c3a2..9556cfc4f5f3 100644
@@ -839,6 +839,8 @@ static void nvme_queue_auth_work(struct work_struct *work)
 	}
 
 fail2:
+	if (chap->status == 0)
+		chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED;
 	dev_dbg(ctrl->device, "%s: qid %d send failure2, status %x\n",
 		__func__, chap->qid, chap->status);
 	tl = nvme_auth_set_dhchap_failure2_data(ctrl, chap);
Signature · 1 line
2.39.2