]> www.infradead.org Git - users/willy/xarray.git/commit
tpm: Clean up TPM space after command failure
authorJonathan McDowell <noodles@meta.com>
Fri, 16 Aug 2024 11:55:46 +0000 (12:55 +0100)
committerJarkko Sakkinen <jarkko@kernel.org>
Tue, 17 Sep 2024 15:56:36 +0000 (18:56 +0300)
commite3aaebcbb7c6b403416f442d1de70d437ce313a7
treea005f173c57a2ba62ba11126835170a11953feb0
parent2f27fce67173bbb05d5a0ee03dae5c021202c912
tpm: Clean up TPM space after command failure

tpm_dev_transmit prepares the TPM space before attempting command
transmission. However if the command fails no rollback of this
preparation is done. This can result in transient handles being leaked
if the device is subsequently closed with no further commands performed.

Fix this by flushing the space in the event of command transmission
failure.

Fixes: 745b361e989a ("tpm: infrastructure for TPM spaces")
Signed-off-by: Jonathan McDowell <noodles@meta.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm-dev-common.c
drivers/char/tpm/tpm2-space.c