]> 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:29:14 +0000 (16:29 +0200)
commit82478cb8a23bd4f97935bbe60d64528c6d9918b4
tree6281dfae4b3acc7863c38511aa6f150b87963694
parent9c21cdae4b93e8fa2740664c589c7f7f49859307
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