]> git.baikalelectronics.ru Git - kernel.git/commit
tee: amdtee: fix memory leak due to reset of global shm list
authorRijo Thomas <Rijo-john.Thomas@amd.com>
Wed, 4 Nov 2020 06:26:09 +0000 (11:56 +0530)
committerJens Wiklander <jens.wiklander@linaro.org>
Mon, 9 Nov 2020 07:58:54 +0000 (08:58 +0100)
commitf52455cf1386c339b53928d92a38a7aacaf1dab3
tree116cf55cf6abbda69fcff9e206af21d16bd5297e
parenta9bb09d87487fe2ee5c4394a0baeb5ae1c443105
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: a1be16c860f4 ("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>
drivers/tee/amdtee/amdtee_private.h
drivers/tee/amdtee/core.c