Skip to content

Commit 36fa3e5

Browse files
Dan Carpenterjenswi-linaro
authored andcommitted
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: 757cc3e ("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>
1 parent 11a48a5 commit 36fa3e5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/tee/amdtee/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ static struct amdtee_session *find_session(struct amdtee_context_data *ctxdata,
139139
u32 index = get_session_index(session);
140140
struct amdtee_session *sess;
141141

142+
if (index >= TEE_NUM_SESSIONS)
143+
return NULL;
144+
142145
list_for_each_entry(sess, &ctxdata->sess_list, list_node)
143146
if (ta_handle == sess->ta_handle &&
144147
test_bit(index, sess->sess_mask))

0 commit comments

Comments
 (0)