crypto: sahara - fix processing hash requests with req->nbytes < sg->length
authorOvidiu Panait <ovidiu.panait@windriver.com>
Sun, 24 Dec 2023 08:21:35 +0000 (10:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:18 +0000 (15:35 -0800)
commit08489b1994cbbf0b41cff46fa3bcbf4cd96522ab
treeb5f9ce9d612e6787ae9fc7f3a4a54054b7681cbb
parent3c3eb0f8bb26d0a8c19d778cf4e54e373bb57cd2
crypto: sahara - fix processing hash requests with req->nbytes < sg->length

[ Upstream commit 7bafa74d1ba35dcc173e1ce915e983d65905f77e ]

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

To fix this, take the actual request size into account when populating the
hw links.

Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256")
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