]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:10:55 +0000 (15:10 +0200)
commitebc4e1f4492d114f9693950621b3ea42b2f82bec
tree1459949555e32dd973fcb4bca74f4baea06c0790
parent07c9cccc4c3fecba175a7e5aafba6370758f5ce2
tpm: Clean up TPM space after command failure

[ Upstream commit e3aaebcbb7c6b403416f442d1de70d437ce313a7 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/tpm/tpm-dev-common.c
drivers/char/tpm/tpm2-space.c