[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230623030427.908-1-mario.limonciello@amd.com>
Date: Thu, 22 Jun 2023 22:04:27 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: <peterhuewe@....de>, <jarkko@...nel.org>, <jgg@...pe.ca>
CC: <linux-integrity@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Mario Limonciello" <mario.limonciello@....com>,
Linux regressions mailing list <regressions@...ts.linux.dev>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Sachin Sant <sachinp@...ux.ibm.com>
Subject: [PATCH] tpm: Ensure that tpm chip has ops to check if it's defective
The ibmvtpm doesn't have `chip->ops` set, and so trying to check
if it's a defective AMD fTPM doesn't work.
Add an extra check to tpm_amd_is_rng_defective() to ensure the
TPM being checked has `chip->ops`.
Cc: Linux regressions mailing list <regressions@...ts.linux.dev>
Reported-by: Aneesh Kumar K. V <aneesh.kumar@...ux.ibm.com>
Reported-by: Sachin Sant <sachinp@...ux.ibm.com>
Link: https://lore.kernel.org/lkml/99B81401-DB46-49B9-B321-CF832B50CAC3@linux.ibm.com/
Tested-by: Sachin Sant <sachinp@...ux.ibm.com>
Fixes: bd8621ca1510 ("tpm: Add !tpm_amd_is_rng_defective() to the hwrng_unregister() call site")
Fixes: f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs")
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
drivers/char/tpm/tpm-chip.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index cd48033b804a..9ba433761e9a 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -524,6 +524,9 @@ static bool tpm_amd_is_rng_defective(struct tpm_chip *chip)
u64 version;
int ret;
+ if (!chip->ops)
+ return false;
+
if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
return false;
--
2.34.1
Powered by blists - more mailing lists