]> 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>
Fri, 4 Oct 2024 14:37:51 +0000 (16:37 +0200)
commit3f9f72d843c92fb6f4ff7460d774413cde7f254c
tree924a6c7d3f6b48e0ad48de7386eba8cc588fe5c8
parent09d14a974d904148f3a652fc785df9b8b6323d0f
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