]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: scatterwalk - Fix memcpy_sglist() to always succeed
authorEric Biggers <ebiggers@kernel.org>
Sat, 15 Nov 2025 23:08:16 +0000 (15:08 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 22 Nov 2025 02:04:50 +0000 (10:04 +0800)
commit4dffc9bbffb9ccfcda730d899c97c553599e7ca8
tree7bb0c52032be9bd5475ad11b1e0d3f9e9da820e5
parent5727a844a3f79b835470aff44a39f6d970ec45dd
crypto: scatterwalk - Fix memcpy_sglist() to always succeed

The original implementation of memcpy_sglist() was broken because it
didn't handle scatterlists that describe exactly the same memory, which
is a case that many callers rely on.  The current implementation is
broken too because it calls the skcipher_walk functions which can fail.
It ignores any errors from those functions.

Fix it by replacing it with a new implementation written from scratch.
It always succeeds.  It's also a bit faster, since it avoids the
overhead of skcipher_walk.  skcipher_walk includes a lot of
functionality (such as alignmask handling) that's irrelevant here.

Reported-by: Colin Ian King <coking@nvidia.com>
Closes: https://lore.kernel.org/r/20251114122620.111623-1-coking@nvidia.com
Fixes: 131bdceca1f0 ("crypto: scatterwalk - Add memcpy_sglist")
Fixes: 0f8d42bf128d ("crypto: scatterwalk - Move skcipher walk and use it for memcpy_sglist")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/scatterwalk.c
include/crypto/scatterwalk.h