ima: Fix potential memory leak in ima_init_crypto()
stable inclusion from stable-v5.10.132 commit c1d9702ceb4a091da6bee380627596d1fba09274 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I5YS3T Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c1d9702ceb4a091da6bee380627596d1fba09274 -------------------------------- [ Upstream commit 067d2521 ] On failure to allocate the SHA1 tfm, IMA fails to initialize and exits without freeing the ima_algo_array. Add the missing kfree() for ima_algo_array to avoid the potential memory leak. Signed-off-by: NJianglei Nie <niejianglei2021@163.com> Fixes: 6d94809a ("ima: Allocate and initialize tfm for each PCR bank") Signed-off-by: NMimi Zohar <zohar@linux.ibm.com> Signed-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com> Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Showing
想要评论请 注册 或 登录