Subject: CVE-2021-46922: KEYS: trusted: Fix TPM reservation for seal/unseal

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

KEYS: trusted: Fix TPM reservation for seal/unseal

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/[email-masked]/

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()

The Linux kernel CVE team has assigned CVE-2021-46922 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.10.20 with commit 67118bb78d72 and fixed in 5.10.33 with commit bf84ef2dd2cc
	Issue introduced in 5.11.3 with commit 498b8fc1cdc1 and fixed in 5.11.17 with commit 39c8d760d44c

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-46922
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	security/keys/trusted-keys/trusted_tpm2.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/bf84ef2dd2ccdcd8f2658476d34b51455f970ce4
	https://git.kernel.org/stable/c/39c8d760d44cb3fa0d67e8cd505df81cf4d80999
	https://git.kernel.org/stable/c/9d5171eab462a63e2fbebfccf6026e92be018f20