]> git.baikalelectronics.ru Git - kernel.git/commit
optee: use driver internal tee_context for some rpc
authorJens Wiklander <jens.wiklander@linaro.org>
Thu, 27 Jan 2022 14:29:39 +0000 (15:29 +0100)
committerJens Wiklander <jens.wiklander@linaro.org>
Thu, 3 Feb 2022 12:36:32 +0000 (13:36 +0100)
commit9b018bdc434d3d9ac7d5f67f0faf8d7e4a2df628
tree4eab3f74e5085fdb483c8a206f8ae77404e5a411
parent59e766ff6f8c2d0f016dfe97ff01198e0de898dc
optee: use driver internal tee_context for some rpc

Adds a driver private tee_context by moving the tee_context in struct
optee_notif to struct optee. This tee_context was previously used when
doing internal calls to secure world to deliver notification.

The new driver internal tee_context is now also when allocating driver
private shared memory. This decouples the shared memory object from its
original tee_context. This is needed when the life time of such a memory
allocation outlives the client tee_context.

This patch fixes the problem described below:

The addition of a shutdown hook by commit 3763967fa697 ("optee: fix tee out
of memory failure seen during kexec reboot") introduced a kernel shutdown
regression that can be triggered after running the OP-TEE xtest suites.

Once the shutdown hook is called it is not possible to communicate any more
with the supplicant process because the system is not scheduling task any
longer. Thus if the optee driver shutdown path receives a supplicant RPC
request from the OP-TEE we will deadlock the kernel's shutdown.

Fixes: 3763967fa697 ("optee: fix tee out of memory failure seen during kexec reboot")
Fixes: 5a1906ede5ad ("tee: use reference counting for tee_context")
Reported-by: Lars Persson <larper@axis.com>
Cc: stable@vger.kernel.org
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/optee/core.c
drivers/tee/optee/ffa_abi.c
drivers/tee/optee/optee_private.h
drivers/tee/optee/smc_abi.c