diff options
author | 2020-11-04 11:56:09 +0530 | |
---|---|---|
committer | 2020-11-09 08:58:54 +0100 | |
commit | ff1f855804cdbbb6db7b9b6df6cab783d1a40d66 (patch) | |
tree | 116cf55cf6abbda69fcff9e206af21d16bd5297e /drivers/tee/amdtee/amdtee_private.h | |
parent | Linux 5.9 (diff) | |
download | linux-ff1f855804cdbbb6db7b9b6df6cab783d1a40d66.tar.gz linux-ff1f855804cdbbb6db7b9b6df6cab783d1a40d66.tar.bz2 linux-ff1f855804cdbbb6db7b9b6df6cab783d1a40d66.zip |
tee: amdtee: fix memory leak due to reset of global shm list
The driver maintains a list of shared memory buffers along with their
mapped buffer id's in a global linked list. These buffers need to be
unmapped after use by the user-space client.
The global shared memory list is initialized to zero entries in the
function amdtee_open(). This clearing of list entries can be a source
for memory leak on secure side if the global linked list previously
held some mapped buffer entries allocated from another TEE context.
Fix potential memory leak issue by moving global shared memory list
to AMD-TEE driver context data structure.
Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
Reviewed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee/amdtee/amdtee_private.h')
-rw-r--r-- | drivers/tee/amdtee/amdtee_private.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/tee/amdtee/amdtee_private.h b/drivers/tee/amdtee/amdtee_private.h index d7f798c3394b..97df16a17285 100644 --- a/drivers/tee/amdtee/amdtee_private.h +++ b/drivers/tee/amdtee/amdtee_private.h @@ -64,9 +64,12 @@ struct amdtee_session { /** * struct amdtee_context_data - AMD-TEE driver context data * @sess_list: Keeps track of sessions opened in current TEE context + * @shm_list: Keeps track of buffers allocated and mapped in current TEE + * context */ struct amdtee_context_data { struct list_head sess_list; + struct list_head shm_list; }; struct amdtee_driver_data { @@ -89,10 +92,6 @@ struct amdtee_shm_data { u32 buf_id; }; -struct amdtee_shm_context { - struct list_head shmdata_list; -}; - #define LOWER_TWO_BYTE_MASK 0x0000FFFF /** |