From: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Thomas Fourier <fourier.thomas@gmail.com>,
Akhil R <akhilrajeev@nvidia.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-crypto@vger.kernel.org (open list:CRYPTO API),
linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE
SUPPORT)
Subject: [PATCH v2] crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init()
Date: Tue, 1 Dec 2026 14:09:29 +0100 [thread overview]
Message-ID: <20261201130951.77541-2-fourier.thomas@gmail.com> (raw)
tegra_sha_do_init() allocates residue.buf with rctx->blk_size bytes, but
when allocating intr_res fails it frees the buffer with
rctx->residue.size, which has just been set to 0. This could leave the
buffer DMA-mapped.
Free the residue buffer with rctx->blk_size.
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Fixes: ff4b7df0b511 ("crypto: tegra - Fix HASH intermediate result handling")
---
v1->v2:
- Remove changes to eastwood driver that was erroneously included
drivers/crypto/tegra/tegra-se-hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/tegra/tegra-se-hash.c b/drivers/crypto/tegra/tegra-se-hash.c
index 23d549801612..8a76df20eb95 100644
--- a/drivers/crypto/tegra/tegra-se-hash.c
+++ b/drivers/crypto/tegra/tegra-se-hash.c
@@ -387,7 +387,7 @@ static int tegra_sha_do_init(struct ahash_request *req)
return 0;
intr_res_fail:
- dma_free_coherent(se->dev, rctx->residue.size, rctx->residue.buf,
+ dma_free_coherent(se->dev, rctx->blk_size, rctx->residue.buf,
rctx->residue.addr);
resbuf_fail:
dma_free_coherent(se->dev, rctx->digest.size, rctx->digest.buf,
--
2.53.0
reply other threads:[~2026-12-01 13:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261201130951.77541-2-fourier.thomas@gmail.com \
--to=fourier.thomas@gmail.com \
--cc=akhilrajeev@nvidia.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jonathanh@nvidia.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@kernel.org \
/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