Commit 37ae6fce authored by Jann Horn's avatar Jann Horn Committed by Greg Kroah-Hartman
Browse files

tee: Prevent size calculation wraparound on 32-bit kernels



[ Upstream commit 39bb67ed ]

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: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
Tested-by: default avatarRouven Czerwinski <rouven.czerwinski@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1e7094b4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment