evm: Fix memleak in init_desc
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sun, 10 Jan 2021 08:02:53 +0000 (16:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:40 +0000 (11:37 +0100)
commit494e9ec12c1b3bf2532b2a518d7206137a01cb6a
tree61408caab7b9ac738d5a550d15c3dad6d1399e89
parentf465abaef3d151106a849131fa74caac7b42413a
evm: Fix memleak in init_desc

[ Upstream commit ccf11dbaa07b328fa469415c362d33459c140a37 ]

tmp_tfm is allocated, but not freed on subsequent kmalloc failure, which
leads to a memory leak.  Free tmp_tfm.

Fixes: d46eb3699502b ("evm: crypto hash replaced by shash")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
[zohar@linux.ibm.com: formatted/reworded patch description]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/integrity/evm/evm_crypto.c