]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
optee: Clear stale cache entries during initialization
authorTyler Hicks <tyhicks@linux.microsoft.com>
Mon, 14 Jun 2021 22:33:13 +0000 (17:33 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Aug 2021 11:21:01 +0000 (13:21 +0200)
commitb247bf412cc235c0d9e33407364f620be5a43d56
tree6dee89c17983f7300b93e8dda48dbac83a247bd9
parent7da261e6bb65594c40f981c4c26b00d8f8148aa0
optee: Clear stale cache entries during initialization

commit b5c10dd04b7418793517e3286cde5c04759a86de upstream.

The shm cache could contain invalid addresses if
optee_disable_shm_cache() was not called from the .shutdown hook of the
previous kernel before a kexec. These addresses could be unmapped or
they could point to mapped but unintended locations in memory.

Clear the shared memory cache, while being careful to not translate the
addresses returned from OPTEE_SMC_DISABLE_SHM_CACHE, during driver
initialization. Once all pre-cache shm objects are removed, proceed with
enabling the cache so that we know that we can handle cached shm objects
with confidence later in the .shutdown hook.

Cc: stable@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-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>
drivers/tee/optee/call.c
drivers/tee/optee/core.c
drivers/tee/optee/optee_private.h