Skip to content

Commit eefc8ed

Browse files
author
CKI Backport Bot
committed
nvmet-auth: assign dh_key to NULL after kfree_sensitive
JIRA: https://issues.redhat.com/browse/RHEL-66830 CVE: CVE-2024-50215 commit d2f551b Author: Vitaliy Shevtsov <v.shevtsov@maxima.ru> Date: Mon Sep 16 22:41:37 2024 +0500 nvmet-auth: assign dh_key to NULL after kfree_sensitive ctrl->dh_key might be used across multiple calls to nvmet_setup_dhgroup() for the same controller. So it's better to nullify it after release on error path in order to avoid double free later in nvmet_destroy_auth(). Found by Linux Verification Center (linuxtesting.org) with Svace. Fixes: 7a277c3 ("nvmet-auth: Diffie-Hellman key exchange support") Cc: stable@vger.kernel.org Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent e876394 commit eefc8ed

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/nvme/target/auth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ int nvmet_setup_dhgroup(struct nvmet_ctrl *ctrl, u8 dhgroup_id)
115115
pr_debug("%s: ctrl %d failed to generate private key, err %d\n",
116116
__func__, ctrl->cntlid, ret);
117117
kfree_sensitive(ctrl->dh_key);
118+
ctrl->dh_key = NULL;
118119
return ret;
119120
}
120121
ctrl->dh_keysize = crypto_kpp_maxsize(ctrl->dh_tfm);

0 commit comments

Comments
 (0)