Skip to content

Commit fc834da

Browse files
alistair23kawasaki
authored andcommitted
nvmet-tcp: Don't clear tls_key when freeing sq
Curently after the host sends a REPLACETLSPSK we free the TLS keys as part of calling nvmet_auth_sq_free() on success. This means when the host sends a follow up REPLACETLSPSK we return CONCAT_MISMATCH as the check for !nvmet_queue_tls_keyid(req->sq) fails. A previous attempt to fix this involed not calling nvmet_auth_sq_free() on successful connections, but that results in memory leaks. Instead we should not clear `tls_key` in nvmet_auth_sq_free(), as that was incorrectly wiping the tls keys which are used for the session. This patch ensures we correctly free the ephemeral session key on connection, yet we don't free the TLS key unless closing the connection. Signed-off-by: Alistair Francis <[email protected]>
1 parent 285c01a commit fc834da

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/nvme/target/auth.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
229229
void nvmet_auth_sq_free(struct nvmet_sq *sq)
230230
{
231231
cancel_delayed_work(&sq->auth_expired_work);
232-
#ifdef CONFIG_NVME_TARGET_TCP_TLS
233-
sq->tls_key = NULL;
234-
#endif
232+
235233
kfree(sq->dhchap_c1);
236234
sq->dhchap_c1 = NULL;
237235
kfree(sq->dhchap_c2);

0 commit comments

Comments
 (0)