]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
commitff1f855804cdbbb6db7b9b6df6cab783d1a40d66
tree116cf55cf6abbda69fcff9e206af21d16bd5297e
parentbbf5c979011a099af5dc76498918ed7df445635b
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>
drivers/tee/amdtee/amdtee_private.h
drivers/tee/amdtee/core.c