KEYS: trusted: Fix TPM reservation for seal/unseal
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Wed, 21 Apr 2021 22:42:47 +0000 (15:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Apr 2021 11:39:59 +0000 (13:39 +0200)
commitbf84ef2dd2ccdcd8f2658476d34b51455f970ce4
tree989ac3407b6f41e301bd6766099cd6e6ee110f31
parent9857fccd653c0d820d45be5baea64ab731f4557e
KEYS: trusted: Fix TPM reservation for seal/unseal

[ Upstream commit 9d5171eab462a63e2fbebfccf6026e92be018f20 ]

The original patch 8c657a0590de ("KEYS: trusted: Reserve TPM for seal
and unseal operations") was correct on the mailing list:

https://lore.kernel.org/linux-integrity/20210128235621.127925-4-jarkko@kernel.org/

But somehow got rebased so that the tpm_try_get_ops() in
tpm2_seal_trusted() got lost.  This causes an imbalanced put of the
TPM ops and causes oopses on TIS based hardware.

This fix puts back the lost tpm_try_get_ops()

Fixes: 8c657a0590de ("KEYS: trusted: Reserve TPM for seal and unseal operations")
Reported-by: Mimi Zohar <zohar@linux.ibm.com>
Acked-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/keys/trusted-keys/trusted_tpm2.c