]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: ccree - Correctly handle return of sg_nents_for_len
authorHaotian Zhang <vulab@iscas.ac.cn>
Mon, 10 Nov 2025 07:20:41 +0000 (15:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:32 +0000 (13:09 +0100)
commitf57925f0c498d3d76dc8310d9d3ec7d401c59c71
tree358eae6f6fe7f4c5affff50e8c9f1ece3c7e2429
parent76fc288ce114dc0543bb84d7188ffd0f344fb165
crypto: ccree - Correctly handle return of sg_nents_for_len

[ Upstream commit 8700ce07c5c6bf27afa7b59a8d9cf58d783a7d5c ]

Fix error handling in cc_map_hash_request_update where sg_nents_for_len
return value was assigned to u32, converting negative errors to large
positive values before passing to sg_copy_to_buffer.

Check sg_nents_for_len return value and propagate errors before
assigning to areq_ctx->in_nents.

Fixes: b7ec8530687a ("crypto: ccree - use std api when possible")
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>
drivers/crypto/ccree/cc_buffer_mgr.c