crypto: tegra: finalize crypto req on error

Call the crypto finalize function before exiting *do_one_req() functions.
This allows the driver to take up further requests even if the previous
one fails.

Bug 4883011

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Change-Id: I36ee3548159e96432e7d15b93f7ef688022dbc87
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3328438
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Akhil R
2025-02-11 15:45:34 +05:30
committed by Jon Hunter
parent f725f36d1e
commit 77c91508d5

View File

@@ -1510,9 +1510,10 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
rctx->inbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen; rctx->inbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen;
rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->inbuf.size, rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->inbuf.size,
&rctx->inbuf.addr, GFP_KERNEL); &rctx->inbuf.addr, GFP_KERNEL);
if (!rctx->inbuf.buf) if (!rctx->inbuf.buf) {
return -ENOMEM; ret = -ENOMEM;
goto out_finalize;
}
rctx->outbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen; rctx->outbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen;
rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->outbuf.size, rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->outbuf.size,
@@ -1560,6 +1561,7 @@ outbuf_err:
dma_free_coherent(ctx->se->dev, rctx->inbuf.size, dma_free_coherent(ctx->se->dev, rctx->inbuf.size,
rctx->inbuf.buf, rctx->inbuf.addr); rctx->inbuf.buf, rctx->inbuf.addr);
out_finalize:
/* Finalize the request if there are no errors */ /* Finalize the request if there are no errors */
crypto_finalize_aead_request(ctx->se->engine, req, ret); crypto_finalize_aead_request(ctx->se->engine, req, ret);