aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/tee
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-02-27 19:19:54 +0300
committerJens Wiklander <jens.wiklander@linaro.org>2020-03-10 08:12:04 +0100
commit36fa3e50085e3858dd506e4431b9abd1bcb1f542 (patch)
tree8522be7349384c78ca9d49dd10745c6c80265eec /drivers/tee
parentLinux 5.6-rc2 (diff)
downloadwireguard-linux-36fa3e50085e3858dd506e4431b9abd1bcb1f542.tar.xz
wireguard-linux-36fa3e50085e3858dd506e4431b9abd1bcb1f542.zip
tee: amdtee: out of bounds read in find_session()
The "index" is a user provided value from 0-USHRT_MAX. If it's over TEE_NUM_SESSIONS (31) then it results in an out of bounds read when we call test_bit(index, sess->sess_mask). Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") Acked-by: Rijo Thomas <Rijo-john.Thomas@amd.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee')
-rw-r--r--drivers/tee/amdtee/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c
index 6370bb55f512..dbc238c7c263 100644
--- a/drivers/tee/amdtee/core.c
+++ b/drivers/tee/amdtee/core.c
@@ -139,6 +139,9 @@ static struct amdtee_session *find_session(struct amdtee_context_data *ctxdata,
u32 index = get_session_index(session);
struct amdtee_session *sess;
+ if (index >= TEE_NUM_SESSIONS)
+ return NULL;
+
list_for_each_entry(sess, &ctxdata->sess_list, list_node)
if (ta_handle == sess->ta_handle &&
test_bit(index, sess->sess_mask))