]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: tegra - Return ENOMEM when input buffer allocation fails for ccm
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 20 May 2026 02:51:14 +0000 (10:51 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 29 May 2026 05:55:57 +0000 (13:55 +0800)
Ensure the ENOMEM error value is set when the input buffer allocation
fails in tegra_ccm_do_one_req.

Fixes: 1e245948ca0c ("crypto: tegra - finalize crypto req on error")
Reported-by: Vladislav Dronov <vdronov@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Vladislav Dronov <vdronov@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/tegra/tegra-se-aes.c

index 5086e7f140c303f916a73c230451c0740d7f477a..9094c03e991f654be484f204d9c0d3443cb67105 100644 (file)
@@ -1215,16 +1215,15 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
        rctx->inbuf.size = bufsize;
        rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, bufsize,
                                             &rctx->inbuf.addr, GFP_KERNEL);
+       ret = -ENOMEM;
        if (!rctx->inbuf.buf)
                goto out_finalize;
 
        rctx->outbuf.size = bufsize;
        rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, bufsize,
                                              &rctx->outbuf.addr, GFP_KERNEL);
-       if (!rctx->outbuf.buf) {
-               ret = -ENOMEM;
+       if (!rctx->outbuf.buf)
                goto out_free_inbuf;
-       }
 
        if (!ctx->key_id) {
                ret = tegra_key_submit_reserved_aes(ctx->se, ctx->key,