From: Herbert Xu <herbert@gondor.apana.org.au>
To: Vladislav Dronov <vdronov@redhat.com>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Akhil R <akhilrajeev@nvidia.com>,
Patrick Talbert <ptalbert@redhat.com>
Subject: [PATCH] crypto: tegra - Return ENOMEM when input buffer allocation fails for ccm
Date: Wed, 20 May 2026 10:51:14 +0800 [thread overview]
Message-ID: <ag0houiGk0cLZ9ls@gondor.apana.org.au> (raw)
In-Reply-To: <CAMusb+T_q1Vu3MD+VjiPWfpe3NNpjJehXWQ9gePo=hM+NGm1zg@mail.gmail.com>
On Tue, May 19, 2026 at 01:42:59PM +0200, Vladislav Dronov wrote:
>
> sashiko.dev makes a point here (
> https://sashiko.dev/#/patchset/agvleqNqloWB6tpf%40gondor.apana.org.au )
> that the code does not set ret to an error value, as done in the other
> similar places, see:
Thanks Vladis. This is an existing bug and I'll fix it with a
separate patch:
---8<---
Ensure the ENOMEM error value is set when the input buffer allocation
fails in tegra_ccm_do_one_req.
Reported-by: Vladislav Dronov <vdronov@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c
index 30c78afe3dea..7ed39b40e4f5 100644
--- a/drivers/crypto/tegra/tegra-se-aes.c
+++ b/drivers/crypto/tegra/tegra-se-aes.c
@@ -1213,16 +1213,15 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
rctx->inbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen + 100;
rctx->inbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->inbuf.size,
&rctx->inbuf.addr, GFP_KERNEL);
+ ret = -ENOMEM;
if (!rctx->inbuf.buf)
goto out_finalize;
rctx->outbuf.size = rctx->assoclen + rctx->authsize + rctx->cryptlen + 100;
rctx->outbuf.buf = dma_alloc_coherent(ctx->se->dev, rctx->outbuf.size,
&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,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2026-05-20 2:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 4:22 [PATCH] crypto: tegra - Fix dma_free_coherent size error Herbert Xu
2026-05-19 12:24 ` Vladislav Dronov
[not found] ` <CAMusb+T_q1Vu3MD+VjiPWfpe3NNpjJehXWQ9gePo=hM+NGm1zg@mail.gmail.com>
2026-05-20 2:51 ` Herbert Xu [this message]
2026-05-20 16:08 ` [PATCH] crypto: tegra - Return ENOMEM when input buffer allocation fails for ccm Vladislav Dronov
2026-05-20 16:28 ` Vladislav Dronov
2026-05-20 16:03 ` [PATCH] crypto: tegra - Fix dma_free_coherent size error Vladislav Dronov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ag0houiGk0cLZ9ls@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=akhilrajeev@nvidia.com \
--cc=linux-crypto@vger.kernel.org \
--cc=ptalbert@redhat.com \
--cc=vdronov@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox