Skip to content

Commit 00686eb

Browse files
alistair23kawasaki
authored andcommitted
Revert "nvmet-tcp: Don't free SQ on authentication success"
In an attempt to fix REPLACETLSPSK we stopped freeing the secrets on successful connections. This resulted in memory leaks in the kernel, so let's revert the commit. A improved fix is being developed to just avoid clearing the tls_key variable. This reverts commit 2e6eb6b. Signed-off-by: Alistair Francis <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
1 parent 6b4d829 commit 00686eb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/nvme/target/fabrics-cmd-auth.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,9 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
395395
goto complete;
396396
}
397397
/* Final states, clear up variables */
398-
if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) {
399-
nvmet_auth_sq_free(req->sq);
398+
nvmet_auth_sq_free(req->sq);
399+
if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE2)
400400
nvmet_ctrl_fatal_error(ctrl);
401-
}
402401

403402
complete:
404403
nvmet_req_complete(req, status);
@@ -574,7 +573,9 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
574573
status = nvmet_copy_to_sgl(req, 0, d, al);
575574
kfree(d);
576575
done:
577-
if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {
576+
if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2)
577+
nvmet_auth_sq_free(req->sq);
578+
else if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {
578579
nvmet_auth_sq_free(req->sq);
579580
nvmet_ctrl_fatal_error(ctrl);
580581
}

0 commit comments

Comments
 (0)