kernel_optimize_test/drivers/tee/optee
Jens Wiklander 5da17865c7 optee: use driver internal tee_context for some rpc
commit aceeafefff736057e8f93f19bbfbef26abd94604 upstream.

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 f25889f93184 ("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: f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot")
Fixes: 217e0250cc ("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>
[JW: backport to 5.10-stable + update commit message]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-02 11:42:47 +01:00
..
call.c tee: Correct inappropriate usage of TEE_SHM_DMA_BUF flag 2021-08-15 14:00:24 +02:00
core.c optee: use driver internal tee_context for some rpc 2022-03-02 11:42:47 +01:00
device.c tee: optee: Fix missing devices unregister during optee_remove 2021-10-20 11:45:02 +02:00
Kconfig
Makefile
optee_msg.h optee: use export_uuid() to copy client UUID 2021-06-10 13:39:21 +02:00
optee_private.h optee: use driver internal tee_context for some rpc 2022-03-02 11:42:47 +01:00
optee_smc.h
rpc.c optee: use driver internal tee_context for some rpc 2022-03-02 11:42:47 +01:00
shm_pool.c tee: optee: Fix incorrect page free bug 2021-12-29 12:26:05 +01:00
shm_pool.h
supp.c