OpenCloudOS-Kernel/drivers/tee
Sumit Garg d3c4786b01 tee: optee: Fix supplicant based device enumeration
[ Upstream commit 7269cba53d906cf257c139d3b3a53ad272176bca ]

Currently supplicant dependent optee device enumeration only registers
devices whenever tee-supplicant is invoked for the first time. But it
forgets to remove devices when tee-supplicant daemon stops running and
closes its context gracefully. This leads to following error for fTPM
driver during reboot/shutdown:

[   73.466791] tpm tpm0: ftpm_tee_tpm_op_send: SUBMIT_COMMAND invoke error: 0xffff3024

Fix this by adding an attribute for supplicant dependent devices so that
the user-space service can detect and detach supplicant devices before
closing the supplicant:

$ for dev in /sys/bus/tee/devices/*; do if [[ -f "$dev/need_supplicant" && -f "$dev/driver/unbind" ]]; \
      then echo $(basename "$dev") > $dev/driver/unbind; fi done

Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Closes: https://github.com/OP-TEE/optee_os/issues/6094
Fixes: 5f178bb71e ("optee: enable support for multi-stage bus enumeration")
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
[jw: fixed up Date documentation]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-13 18:45:11 +01:00
..
amdtee tee: amdtee: fix use-after-free vulnerability in amdtee_close_session 2023-10-03 19:13:53 +02:00
optee tee: optee: Fix supplicant based device enumeration 2023-12-13 18:45:11 +01:00
Kconfig tee: combine "config" and "menu" for TEE's menuconfig 2022-04-05 07:32:23 +02:00
Makefile tee: add AMD-TEE driver 2020-01-04 13:49:51 +08:00
tee_core.c driver core: class: remove module * from class_create() 2023-03-17 15:16:33 +01:00
tee_private.h tee: Remove unused declarations 2023-09-13 08:16:24 +02:00
tee_shm.c tee: Pass a pointer to virt_to_page() 2023-03-30 08:34:52 +02:00
tee_shm_pool.c tee: refactor TEE_SHM_* flags 2022-02-16 07:49:41 +01:00