Skip to content

Commit 067d252

Browse files
Jianglei Niemimizohar
authored andcommitted
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: Jianglei Nie <niejianglei2021@163.com> Fixes: 6d94809 ("ima: Allocate and initialize tfm for each PCR bank") Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent af16df5 commit 067d252

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

security/integrity/ima/ima_crypto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ int __init ima_init_crypto(void)
205205

206206
crypto_free_shash(ima_algo_array[i].tfm);
207207
}
208+
kfree(ima_algo_array);
208209
out:
209210
crypto_free_shash(ima_shash_tfm);
210211
return rc;

0 commit comments

Comments
 (0)