[PATCH v2] crypto: atmel-tdes - use scatterlist length before DMA mapping

Herbert Xu herbert at gondor.apana.org.au
Sun Jul 5 01:28:54 PDT 2026


On Thu, Jun 11, 2026 at 12:36:35PM +0200, Thorsten Blum wrote:
> Using sg_dma_len() is only valid after mapping the scatterlist with
> dma_map_sg(). However, atmel_tdes_crypt_start() uses it before mapping
> to compare input/output lengths and to compute the transfer count.
> 
> Use the original scatterlist lengths before DMA mapping to avoid reading
> stale or uninitialized DMA lengths when CONFIG_NEED_SG_DMA_LENGTH=y.
> 
> Drop the output scatterlist length in the fast path since it is equal to
> ->in_sg->length and does not change the transfer count.
> 
> Fixes: 13802005d8f2 ("crypto: atmel - add Atmel DES/TDES driver")
> Fixes: 1f858040c2f7 ("crypto: atmel-tdes - add support for latest release of the IP (0x700)")
> Cc: stable at vger.kernel.org
> Signed-off-by: Thorsten Blum <thorsten.blum at linux.dev>
> ---
> Changes in v2:
> - Drop ->out_sg->length in the fast path (Herbert)
> - v1: https://lore.kernel.org/lkml/20260531204115.689052-3-thorsten.blum@linux.dev/
> ---
>  drivers/crypto/atmel-tdes.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-arm-kernel mailing list