linux/drivers/crypto/starfive
Haotian Zhang 0c3854d65c crypto: starfive - Correctly handle return of sg_nents_for_len
[ Upstream commit e9eb52037a ]

The return value of sg_nents_for_len was assigned to an unsigned long
in starfive_hash_digest, causing negative error codes to be converted
to large positive integers.

Add error checking for sg_nents_for_len and return immediately on
failure to prevent potential buffer overflows.

Fixes: 7883d1b28a ("crypto: starfive - Add hash and HMAC support")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-12-18 13:55:05 +01:00
..
jh7110-aes.c crypto: starfive - Use fallback for unaligned dma access 2024-05-10 17:15:24 +08:00
jh7110-cryp.c crypto: starfive - Use dma for aes requests 2024-04-02 10:49:38 +08:00
jh7110-cryp.h crypto: starfive - Fix nent assignment in rsa dec 2024-07-06 10:20:00 +10:00
jh7110-hash.c crypto: starfive - Correctly handle return of sg_nents_for_len 2025-12-18 13:55:05 +01:00
jh7110-rsa.c crypto: starfive - Fix nent assignment in rsa dec 2024-07-06 10:20:00 +10:00
Kconfig crypto: starfive - Use dma for aes requests 2024-04-02 10:49:38 +08:00
Makefile crypto: starfive - Add AES skcipher and aead support 2023-07-28 18:20:25 +08:00