crypto: sahara - fix processing requests with cryptlen < sg->length
authorOvidiu Panait <ovidiu.panait@windriver.com>
Fri, 1 Dec 2023 17:06:22 +0000 (19:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:16 +0000 (15:35 -0800)
commit4167eb9412d43b08d6102543b94820943a65b2d9
tree26dcd4410f2f3968e5d60cbbbc51af683487b9ee
parentab82cb379a5ac5e5151ca6cadf624dfa57f6d5d4
crypto: sahara - fix processing requests with cryptlen < sg->length

[ Upstream commit 5b8668ce3452827d27f8c34ff6ba080a8f983ed0 ]

It's not always the case that the entire sg entry needs to be processed.
Currently, when cryptlen is less than sg->legth, "Descriptor length" errors
are encountered.

The error was noticed when testing xts(sahara-ecb-aes) with arbitrary sized
input data. To fix this, take the actual request size into account when
populating the hw links.

Fixes: 5de8875281e1 ("crypto: sahara - Add driver for SAHARA2 accelerator.")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/sahara.c