Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lee Jones" <lee@kernel.org>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	"Paul Louvel" <paul.louvel@bootlin.com>,
	"Evgeniy Polyakov" <johnpol@2ka.mipt.ru>,
	"Kim Phillips" <kim.phillips@freescale.com>,
	"Christophe Leroy" <chleroy@kernel.org>,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH 06/10] crypto: talitos - Remove duplicate IV unmap in AEAD encrypt path
Date: Mon, 23 Nov 2026 15:19:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-229527@kernel.org> (raw)
In-Reply-To: <20261123151055.2533735-7-lee@kernel.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] crypto: talitos: DMA address truncation in
  unmap_single_talitos_ptr() [1]
--

commit 7421990fbcd39641bb3ac45651a2ed7bcb79c461
Author: Lee Jones <lee@kernel.org>

crypto: talitos - Remove duplicate IV unmap in AEAD encrypt path

This commit removes a duplicate dma_unmap_single() call on edesc->iv_dma in
ipsec_esp_encrypt_done(), relying on ipsec_esp_unmap() to unmap civ_ptr via
unmap_single_talitos_ptr().

> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index c7d9ce2905be7..be7a281319450 100644
> --- a/drivers/crypto/talitos.c
> +++ b/drivers/crypto/talitos.c
> @@ -1097,16 +1097,12 @@ static void ipsec_esp_encrypt_done(struct device *dev,
>  				   int err)
>  {
>  	struct aead_request *areq = context;
> -	struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
> -	unsigned int ivsize = crypto_aead_ivsize(authenc);
>  	struct talitos_edesc *edesc;
>  
>  	edesc = container_of(desc, struct talitos_edesc, desc);
>  
>  	ipsec_esp_unmap(dev, edesc, areq, true);
>  
> -	dma_unmap_single(dev, edesc->iv_dma, ivsize, DMA_TO_DEVICE);

[Severity: Critical]
This problem wasn't introduced by this patch, but does
unmap_single_talitos_ptr() truncate >32-bit DMA addresses [1] when
ipsec_esp_unmap() unmaps civ_ptr?

While to_talitos_ptr() stores the upper bits of a >32-bit DMA address in
ptr->eptr on non-SEC1 hardware, unmap_single_talitos_ptr() ignores
ptr->eptr and only passes the lower 32 bits to dma_unmap_single():

drivers/crypto/talitos.c:unmap_single_talitos_ptr() {
	struct talitos_private *priv = dev_get_drvdata(dev);\
	bool is_sec1 = has_ftr_sec1(priv);

	dma_unmap_single(dev, be32_to_cpu(ptr->ptr),
			 from_talitos_ptr_len(ptr, is_sec1), dir);
}

On systems with >4GB physical memory, this leaks the intended IOMMU mapping
and unmaps an unrelated truncated DMA address, which can cause IOMMU faults
and memory corruption.

[1] https://sashiko.dev/#/bug/linux-fc697335-3f0d-4823-8b99-a6069def8475

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123151055.2533735-1-lee@kernel.org?part=6

  reply	other threads:[~2026-11-23 15:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 15:09 [PATCH 00/10] crypto: Assorted bug fixes across crypto drivers Lee Jones
2026-11-23 15:09 ` [PATCH 01/10] crypto: caam - Fix descriptor buffer overflow in caam_process_blob() Lee Jones
2026-11-23 15:09 ` [PATCH 02/10] crypto: marvell - Fix AEAD key buffer overflow for SHA-384/512 HMAC Lee Jones
2026-11-23 15:09 ` [PATCH 03/10] crypto: nx - Fix bounce buffer copy overflow in decompress() Lee Jones
2026-11-23 15:37   ` sashiko-bot
2026-11-23 15:09 ` [PATCH 04/10] crypto: sun8i-ss - Fix scatterlist array overflow for HMAC requests Lee Jones
2026-11-23 15:09 ` [PATCH 05/10] crypto: hisilicon/hpre - Fix buffer overflow on odd ECDH input size Lee Jones
2026-11-23 15:09 ` [PATCH 06/10] crypto: talitos - Remove duplicate IV unmap in AEAD encrypt path Lee Jones
2026-11-23 15:19   ` sashiko-bot [this message]
2026-11-23 15:09 ` [PATCH 07/10] crypto: safexcel - Check scatterlist errors before max() for in-place Lee Jones
2026-11-23 15:09 ` [PATCH 08/10] crypto: qce - Pass mapped scatterlist count to qce_dma_prep_sgs() Lee Jones
2026-11-23 15:10 ` [PATCH 09/10] crypto: qce - Terminate RX DMA channel if TX preparation fails Lee Jones
2026-11-23 15:10 ` [PATCH 10/10] crypto: atmel-tdes - Update output IV before clearing busy flag Lee Jones

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-229527@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=johnpol@2ka.mipt.ru \
    --cc=kim.phillips@freescale.com \
    --cc=lee@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=paul.louvel@bootlin.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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