summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorJerry Snitselaar <jsnitsel@redhat.com>2023-06-29 23:41:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-23 14:49:31 +0300
commitbb4e824d6b11276c54f525c91e293f692a873e2b (patch)
treeb7d80a6d1870ed7c09eb0bc2a757e120d0ffc142 /drivers/char
parentad249709d2747c127b02d456f058990c0ad3ae6d (diff)
downloadlinux-bb4e824d6b11276c54f525c91e293f692a873e2b.tar.xz
tpm: return false from tpm_amd_is_rng_defective on non-x86 platforms
commit ecff6813d2bcf0c670881a9ba3f51cb032dd405a upstream. tpm_amd_is_rng_defective is for dealing with an issue related to the AMD firmware TPM, so on non-x86 architectures just have it inline and return false. Cc: stable@vger.kernel.org # v6.3+ Reported-by: Sachin Sant <sachinp@linux.ibm.com> Reported-by: Aneesh Kumar K. V <aneesh.kumar@linux.ibm.com> Closes: https://lore.kernel.org/lkml/99B81401-DB46-49B9-B321-CF832B50CAC3@linux.ibm.com/ Fixes: f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs") Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm-chip.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 95d847c9de79..d7ef4d0a7409 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -515,6 +515,7 @@ static int tpm_add_legacy_sysfs(struct tpm_chip *chip)
* 6.x.y.z series: 6.0.18.6 +
* 3.x.y.z series: 3.57.y.5 +
*/
+#ifdef CONFIG_X86
static bool tpm_amd_is_rng_defective(struct tpm_chip *chip)
{
u32 val1, val2;
@@ -563,6 +564,12 @@ release:
return true;
}
+#else
+static inline bool tpm_amd_is_rng_defective(struct tpm_chip *chip)
+{
+ return false;
+}
+#endif /* CONFIG_X86 */
static int tpm_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait)
{