Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 77a06908 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 39bb67edcc582b3b386a9ec983da67fa8a10ec03 ]

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 54edad2d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment