Re: [PATCH] crypto: scatterwalk: propagate errors from failed call to skcipher_walk_first

From: Eric Biggers

Date: Fri Nov 14 2025 - 14:28:15 EST


On Fri, Nov 14, 2025 at 12:26:19PM +0000, Colin Ian King wrote:
> There are cases where skcipher_walk_first can fail and errors such as
> -ENOMEM or -EDEADLK are being ignored in memcpy_sglist. Add error checks
> and propagate the error down to callers.
>
> This fixes silent data loss from callers to memcpy_sglist (since walk is
> zero'd) or potential encryption on the wrong data.
>
> Signed-off-by: Colin Ian King <coking@xxxxxxxxxx>

There's no need for copying between two scatterlists to be able to fail.
memcpy_sglist() should just be implemented from first principles instead
of misusing the skcipher_walk stuff. I actually suggested this already
(https://lore.kernel.org/linux-crypto/20250427010834.GB68006@quark/) but
unfortunately it was disregarded.

- Eric