WSL2-Linux-Kernel/drivers/char
Tyler Hicks dfb703ad2a tpm_ftpm_tee: Free and unregister TEE shared memory during kexec
dma-buf backed shared memory cannot be reliably freed and unregistered
during a kexec operation even when tee_shm_free() is called on the shm
from a .shutdown hook. The problem occurs because dma_buf_put() calls
fput() which then uses task_work_add(), with the TWA_RESUME parameter,
to queue tee_shm_release() to be called before the current task returns
to user mode. However, the current task never returns to user mode
before the kexec completes so the memory is never freed nor
unregistered.

Use tee_shm_alloc_kernel_buf() to avoid dma-buf backed shared memory
allocation so that tee_shm_free() can directly call tee_shm_release().
This will ensure that the shm can be freed and unregistered during a
kexec operation.

Fixes: 09e574831b ("tpm/tpm_ftpm_tee: A driver for firmware TPM running inside TEE")
Fixes: 1760eb689e ("tpm/tpm_ftpm_tee: add shutdown call back")
Cc: stable@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:55:50 +02:00
..
agp
hw_random ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
ipmi Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
mwave
pcmcia TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
tpm tpm_ftpm_tee: Free and unregister TEE shared memory during kexec 2021-07-21 07:55:50 +02:00
xilinx_hwicap
xillybus char: xillybus: Fix spelling mistake "overflew" -> "overflowed" 2021-06-03 14:11:08 +02:00
Kconfig TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
Makefile remove the raw driver 2021-06-04 15:35:03 +02:00
adi.c
apm-emulation.c
applicom.c
applicom.h
bsr.c
ds1620.c
dsp56k.c
dtlk.c
hangcheck-timer.c
hpet.c char: hpet: Remove unused variable 'm' 2021-05-21 10:09:30 +02:00
lp.c
mem.c remove the raw driver 2021-06-04 15:35:03 +02:00
misc.c
mspec.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c powerpc/powernv: Fix fall-through warning for Clang 2021-07-13 19:21:41 -05:00
ppdev.c
ps3flash.c
random.c
scx200_gpio.c
sonypi.c
tb0219.c
tlclk.c
toshiba.c
ttyprintk.c ttyprintk: remove redundant initialization of variable i 2021-05-27 14:19:50 +02:00
uv_mmtimer.c
virtio_console.c virtio_console: Assure used length from device is limited 2021-07-03 04:50:53 -04:00