Skip to content

Commit 1982961

Browse files
Vitaliy Shevtsovvijay-suman
authored andcommitted
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: [email protected] Signed-off-by: Vitaliy Shevtsov <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Keith Busch <[email protected]> (cherry picked from commit d2f551b) Orabug: 37268555 CVE: CVE-2024-50215 Signed-off-by: Himanshu Madhani <[email protected]> Reviewed-by: Alok Tiwari <[email protected]> Signed-off-by: Vijayendra Suman <[email protected]>
1 parent d1bde92 commit 1982961

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
@@ -101,6 +101,7 @@ int nvmet_setup_dhgroup(struct nvmet_ctrl *ctrl, u8 dhgroup_id)
101101
pr_debug("%s: ctrl %d failed to generate private key, err %d\n",
102102
__func__, ctrl->cntlid, ret);
103103
kfree_sensitive(ctrl->dh_key);
104+
ctrl->dh_key = NULL;
104105
return ret;
105106
}
106107
ctrl->dh_keysize = crypto_kpp_maxsize(ctrl->dh_tfm);

0 commit comments

Comments
 (0)