lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed,  7 Jun 2023 12:16:47 -0400
From:   Stefan Berger <stefanb@...ux.ibm.com>
To:     linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
        jarkko@...nel.org
Cc:     Stefan Berger <stefanb@...ux.ibm.com>
Subject: [PATCH] tpm: Check for availability of chip->ops before requesting locality

When executing kexec on ppc64 tpm_class_shutdown() is called before
tpm_chip_unregister() and therefore chip->ops is NULL when
tpm_amd_is_rng_defective() is called. Check for chip->ops before
requesting the locality in tpm_amd_is_rng_defective() to avoid a
crash.

Fixes: bd8621ca1510 ("tpm: Add !tpm_amd_is_rng_defective() to the hwrng_unregister() call site")
Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
---
 drivers/char/tpm/tpm-chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index cd48033b804a..bc1ec1632fd8 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -524,7 +524,7 @@ static bool tpm_amd_is_rng_defective(struct tpm_chip *chip)
 	u64 version;
 	int ret;
 
-	if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
+	if (!chip->ops || !(chip->flags & TPM_CHIP_FLAG_TPM2))
 		return false;
 
 	ret = tpm_request_locality(chip);
-- 
2.39.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ