linux/drivers/tee
Jann Horn cdc1b9b47b 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:08:57 +01:00
..
amdtee tee: amdtee: fix use-after-free vulnerability in amdtee_close_session 2023-10-03 19:13:53 +02:00
optee tee: optee: Fix supplicant wait loop 2025-02-27 04:10:51 -08:00
Kconfig tee: combine "config" and "menu" for TEE's menuconfig 2022-04-05 07:32:23 +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:08:57 +01:00
tee_private.h tee: Remove unused declarations 2023-09-13 08:16:24 +02:00
tee_shm.c tee: Pass a pointer to virt_to_page() 2023-03-30 08:34:52 +02:00
tee_shm_pool.c tee: refactor TEE_SHM_* flags 2022-02-16 07:49:41 +01:00