Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Fourier" <fourier.thomas@gmail.com>
Cc: "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>,
	"open list:CRYPTO API" <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH] crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init()
Date: Tue, 01 Dec 2026 09:46:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-242994@kernel.org> (raw)
In-Reply-To: <20261201093717.7521-2-fourier.thomas@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] crypto: tegra - unrelated fluke_dma_read() change bundled
  into commit
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [Critical] gpib: unhandled dma_map_single() failure in fluke and fmh
  DMA transfers [1]
--

commit 0f61af3df7a71e6095c67cd6f36bba561cd161e0
Author: Thomas Fourier <fourier.thomas@gmail.com>

crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init()

This commit passes rctx->blk_size instead of rctx->residue.size to
dma_free_coherent() on the intr_res_fail error path in tegra_sha_do_init(),
and also updates a dma_unmap_single() call in fluke_dma_read().

> diff --git a/drivers/gpib/eastwood/fluke_gpib.c b/drivers/gpib/eastwood/fluke_gpib.c
> index 1363f0a1f5701..f08a8229aa99d 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);

[Severity: Medium]
Was this fluke_dma_read() change in the GPIB eastwood driver folded into
the Tegra crypto commit by mistake?  It fixes a bug from 55936779f496
("staging: gpib: Add Fluke cda based cards GPIB driver") in an unrelated
subsystem and should be split into its own patch.

[Severity: Critical]
This problem wasn't introduced by this patch, but fluke_dma_read() and
fluke_dma_write() never check the address returned by dma_map_single()
with dma_mapping_error() [1]:

drivers/gpib/eastwood/fluke_gpib.c:fluke_dma_read() {
    ...
	bus_address = dma_map_single(board->dev, e_priv->dma_buffer,
				     length, DMA_FROM_DEVICE);

	/* program dma controller */
	retval = fluke_config_dma(board, 0);
    ...
}

In the sibling fmh_gpib_dma_read() and fmh_gpib_dma_write() functions in
drivers/gpib/fmh_gpib/fmh_gpib.c, dma_mapping_error() is logged with
dev_err(), but execution continues without returning an error.  When DMA
mapping fails, all four paths pass DMA_MAPPING_ERROR to
dmaengine_prep_slave_single(), submit the transfer to the DMA controller,
and later pass the invalid address to dma_unmap_single(), which can trigger
DMA or IOMMU faults and memory corruption.

[1] https://sashiko.dev/#/bug/linux-ee72ea5b-39f1-4760-9696-84b497f26d28

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201093717.7521-2-fourier.thomas@gmail.com?part=1

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

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

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=sashiko-outbox-242994@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akhilrajeev@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=dominik.karol.piatkowski@protonmail.com \
    --cc=dpenkler@gmail.com \
    --cc=fourier.thomas@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jonathanh@nvidia.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox