tis: fix tpm_tis_remove()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 28 Nov 2021 23:03:44 +0000 (00:03 +0100)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 30 Nov 2021 12:11:05 +0000 (14:11 +0200)
commitc3de051c411e024f9e63ab338071584b9460e8b3
treeecd155d8e96bcf38bdf43fabeceb44fb138b6a28
parentade37460a944aed36ae6ee634c4d4a9a22690461
tis: fix tpm_tis_remove()

tpm_tis_remove() leads to calling tpm_tis_ready() with the IO region
unmapped and chip->locality == -1 (locality released). This leads to a
crash in mmio_write_bytes().

The patch implements these changes:

tpm_tis_remove(): Unmap the IO region after calling tpm_tis_cleanup().

tpm_tis_cleanup(): Request locality before IO output and releasing
locality.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
drivers/tpm/tpm2_tis_core.c
drivers/tpm/tpm2_tis_mmio.c