linux/drivers/tee
Jann Horn dd89a7e18c tee: Prevent size calculation wraparound on 32-bit kernels
[ Upstream commit 39bb67edcc ]

The current code around TEE_IOCTL_PARAM_SIZE() is a bit wrong on
32-bit kernels: Multiplying a user-provided 32-bit value with the
size of a structure can wrap around on such platforms.

Fix it by using saturating arithmetic for the size calculation.

This has no security consequences because, in all users of
TEE_IOCTL_PARAM_SIZE(), the subsequent kcalloc() implicitly checks
for wrapping.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Tested-by: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-06-27 11:05:33 +01:00
..
amdtee tee: amdtee: fix use-after-free vulnerability in amdtee_close_session 2023-10-19 23:05:37 +02:00
optee tee: optee: Fix supplicant wait loop 2025-03-13 12:50:53 +01:00
Kconfig tee: fix crypto select 2020-05-28 12:38:00 +02:00
Makefile tee: add AMD-TEE driver 2020-01-04 13:49:51 +08:00
tee_core.c tee: Prevent size calculation wraparound on 32-bit kernels 2025-06-27 11:05:33 +01:00
tee_private.h tee: don't assign shm id for private shms 2020-02-28 13:37:42 +01:00
tee_shm.c tee: Fix tee_shm_register() for kernel TEE drivers 2022-11-10 18:15:42 +01:00
tee_shm_pool.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00