]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: aspeed/hash - Fix potential overflow in dma_prepare_sg
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 13 May 2025 06:04:11 +0000 (14:04 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 13 Jun 2025 09:26:15 +0000 (17:26 +0800)
commit8c8f269a58f8aa245c39e732a35560b5884c3461
tree518529d335c5ba32bcd2a728ff14dccc07c7aed5
parent0602f0ef9308fe8a27c2e3325f8281432a5e0a71
crypto: aspeed/hash - Fix potential overflow in dma_prepare_sg

The mapped SG lists are written to hash_engine->ahash_src_addr which
has the size ASPEED_HASH_SRC_DMA_BUF_LEN.  Since scatterlists are
not bound in size, make sure that size is not exceeded.

If the mapped SG list is larger than the buffer, simply iterate
over it as is done in the dma_prepare case.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/aspeed/aspeed-hace-hash.c