From 7cf41996cbb9b4256d73908a7c9c4dba41357c7d Mon Sep 17 00:00:00 2001 From: Akhil R Date: Tue, 17 Oct 2023 14:12:36 +0530 Subject: [PATCH] crypto: tegra: Free CMAC fallback tfm during exit Free the CMAC fallback tfm to fix the memory leak during CMAC operation. The fallback tfm is setup during init but never freed. Signed-off-by: Akhil R Change-Id: Icb9ccf330f94e93459c241ed7105a221832c0514 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2998701 Reviewed-by: svcacv Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- drivers/crypto/tegra/tegra-se-aes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c index f1476209..f1ac0afe 100644 --- a/drivers/crypto/tegra/tegra-se-aes.c +++ b/drivers/crypto/tegra/tegra-se-aes.c @@ -1664,6 +1664,9 @@ static void tegra_cmac_cra_exit(struct crypto_tfm *tfm) struct tegra_cmac_ctx *ctx = crypto_tfm_ctx(tfm); tegra_key_invalidate(ctx->se, ctx->key_id); + + if (ctx->fallback_tfm) + crypto_free_shash(ctx->fallback_tfm); } static int tegra_cmac_init(struct ahash_request *req)