Commit 067d2521 authored by Jianglei Nie's avatar Jianglei Nie Committed by Mimi Zohar
Browse files

ima: Fix potential memory leak in ima_init_crypto()



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: default avatarJianglei Nie <niejianglei2021@163.com>
Fixes: 6d94809a ("ima: Allocate and initialize tfm for each PCR bank")
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
parent af16df54
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ int __init ima_init_crypto(void)

		crypto_free_shash(ima_algo_array[i].tfm);
	}
	kfree(ima_algo_array);
out:
	crypto_free_shash(ima_shash_tfm);
	return rc;