Skip to content
Commit 51dd64bb authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Mimi Zohar
Browse files

Revert "evm: Fix memleak in init_desc"



This reverts commit ccf11dba.

Commit ccf11dba ("evm: Fix memleak in init_desc") said there is
memleak in init_desc. That may be incorrect, as we can see, tmp_tfm is
saved in one of the two global variables hmac_tfm or evm_tfm[hash_algo],
then if init_desc is called next time, there is no need to alloc tfm
again, so in the error path of kmalloc desc or crypto_shash_init(desc),
It is not a problem without freeing tmp_tfm.

And also that commit did not reset the global variable to NULL after
freeing tmp_tfm and this makes *tfm a dangling pointer which may cause a
UAF issue.

Reported-by: default avatarGuozihua (Scott) <guozihua@huawei.com>
Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
parent b13baccc
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment