linux-stable/drivers/tee
Rijo Thomas b3ef9e6fe0 tee: amdtee: fix race condition in amdtee_open_session
commit f8502fba45 upstream.

There is a potential race condition in amdtee_open_session that may
lead to use-after-free. For instance, in amdtee_open_session() after
sess->sess_mask is set, and before setting:

    sess->session_info[i] = session_info;

if amdtee_close_session() closes this same session, then 'sess' data
structure will be released, causing kernel panic when 'sess' is
accessed within amdtee_open_session().

The solution is to set the bit sess->sess_mask as the last step in
amdtee_open_session().

Fixes: 757cc3e9ff ("tee: add AMD-TEE driver")
Cc: stable@vger.kernel.org
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-30 12:51:41 +02:00
..
amdtee tee: amdtee: fix race condition in amdtee_open_session 2023-03-30 12:51:41 +02:00
optee SoC driver updates for 6.2 2022-12-12 10:17:08 -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: tee_get_drvdata(): fix description of return value 2022-07-08 10:51:24 +02:00
tee_private.h tee: add tee_shm_register_{user,kernel}_buf() 2022-02-16 07:49:41 +01:00
tee_shm.c tee: fix compiler warning in tee_shm_register() 2022-08-25 11:40:06 +02:00
tee_shm_pool.c tee: refactor TEE_SHM_* flags 2022-02-16 07:49:41 +01:00