All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	"Dave Penkler" <dpenkler@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Dominik Karol Piątkowski"
	<dominik.karol.piatkowski@protonmail.com>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	linux-crypto@vger.kernel.org (open list:CRYPTO API),
	linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE
	SUPPORT), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init()
Date: Tue,  1 Dec 2026 10:37:08 +0100	[thread overview]
Message-ID: <20261201093717.7521-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")
---
 drivers/crypto/tegra/tegra-se-hash.c | 2 +-
 drivers/gpib/eastwood/fluke_gpib.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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,
diff --git a/drivers/gpib/eastwood/fluke_gpib.c b/drivers/gpib/eastwood/fluke_gpib.c
index 1363f0a1f570..f08a8229aa99 100644
--- a/drivers/gpib/eastwood/fluke_gpib.c
+++ b/drivers/gpib/eastwood/fluke_gpib.c
@@ -585,7 +585,7 @@ static int fluke_dma_read(struct gpib_board *board, u8 *buffer,
 					      DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 	if (!tx_desc) {
 		dev_err(board->gpib_dev, "failed to allocate dma transmit descriptor\n");
-		dma_unmap_single(NULL, bus_address, length, DMA_FROM_DEVICE);
+		dma_unmap_single(board->dev, bus_address, length, DMA_FROM_DEVICE);
 		return -EIO;
 	}
 	tx_desc->callback = fluke_dma_callback;
-- 
2.53.0


             reply	other threads:[~2026-12-01  9:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:37 Thomas Fourier [this message]
2026-12-01  9:46 ` [PATCH] crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init() sashiko-bot

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=20261201093717.7521-2-fourier.thomas@gmail.com \
    --to=fourier.thomas@gmail.com \
    --cc=akhilrajeev@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=dominik.karol.piatkowski@protonmail.com \
    --cc=dpenkler@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jonathanh@nvidia.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@kernel.org \
    --cc=u.kleine-koenig@baylibre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.