[PATCH 17/30] crypto: sa2ul - fix resource leak of AEAD in init_alg() error path
From: Manorit Chawdhry
Date: Tue Sep 15 2026 - 06:34:55 EST
Add crypto_free_shash() call before returning the error to properly
clean up the resource allocated in the previous call.
Fixes: d2c8ac187fc9 ("crypto: sa2ul - Add AEAD algorithm support")
Assisted-by: Sisyphus:claude-sonnet-4-6
Signed-off-by: Manorit Chawdhry <m-chawdhry@xxxxxx>
---
drivers/crypto/sa2ul.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index 9379d1271698..dcddb81dc842 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -1671,6 +1671,7 @@ static int sa_cra_init_aead(struct crypto_aead *tfm, const char *hash,
if (IS_ERR(ctx->fallback.aead)) {
dev_err(sa_k3_dev, "fallback driver %s couldn't be loaded\n",
fallback);
+ crypto_free_shash(ctx->shash);
return PTR_ERR(ctx->fallback.aead);
}
--
2.43.0