Re: [PATCH] crypto: octeontx2 - Unwind allocations when AEAD initialization fails

From: Herbert Xu

Date: Fri Nov 13 2026 - 13:08:56 EST


On Tue, Nov 03, 2026 at 06:42:48AM +0000, Wentao Liang wrote:
> cpt_aead_init() allocates a hash transform, descriptor and pads before
> looking up a CPT device and initializing the hardware context. Failures
> in those later steps return without freeing the earlier allocations.
> If fallback allocation fails, the hardware context is also left mapped
> and allocated. The algorithm exit callback does not run after a failed
> initialization.
>
> Release the hardware context when fallback initialization fails and free
> the hash resources on all three failure paths.
>
> Fixes: 6f03f0e8b6c8 ("crypto: octeontx2 - register with linux crypto framework")
> Fixes: e92971117c2c ("crypto: octeontx2 - add ctx_val workaround")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
> ---
> .../crypto/marvell/octeontx2/otx2_cptvf_algs.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt