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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240906060947.4844-3-wahrenst@gmx.net>
Date: Fri,  6 Sep 2024 08:09:47 +0200
From: Stefan Wahren <wahrenst@....net>
To: Peter Huewe <peterhuewe@....de>,
	Jarkko Sakkinen <jarkko@...nel.org>,
	Jason Gunthorpe <jgg@...pe.ca>
Cc: linux-integrity@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Stefan Berger <stefanb@...ux.ibm.com>,
	Stefan Wahren <wahrenst@....net>
Subject: [PATCH RFC 2/2] tpm: tpm_tis: Provide error messages in tpm_tis_core_init

In case of SPI wiring issues (e.g. MISO pin permanent high) the
core init won't provide any error message on failure. Add some
helpful error messages to tpm_tis_core_init(), which helps
to better understand why the driver won't probe.

Signed-off-by: Stefan Wahren <wahrenst@....net>
---
 drivers/char/tpm/tpm_tis_core.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index fdef214b9f6b..830e331fcebe 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -1133,8 +1133,10 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	dev_set_drvdata(&chip->dev, priv);

 	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
-	if (rc < 0)
+	if (rc < 0) {
+		dev_err(dev, "Failed to read TPM_DID_VID register: %d\n", rc);
 		return rc;
+	}

 	priv->manufacturer_id = vendor;

@@ -1162,19 +1164,25 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		chip->ops->clk_enable(chip, true);

 	if (wait_startup(chip, 0) != 0) {
+		dev_err(dev, "TPM device not accessible (0x%0x)\n",
+			vendor);
 		rc = -ENODEV;
 		goto out_err;
 	}

 	/* Take control of the TPM's interrupt hardware and shut it off */
 	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
-	if (rc < 0)
+	if (rc < 0) {
+		dev_err(dev, "Failed to read TPM_INT_ENABLE register: %d\n", rc);
 		goto out_err;
+	}

 	/* Figure out the capabilities */
 	rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
-	if (rc < 0)
+	if (rc < 0) {
+		dev_err(dev, "Failed to read TPM_INTF_CAPS register: %d\n", rc);
 		goto out_err;
+	}

 	dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
 		intfcaps);
@@ -1209,6 +1217,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,

 	rc = tpm_tis_request_locality(chip, 0);
 	if (rc < 0) {
+		dev_err(dev, "Failed to request locality (0x%0x)\n", vendor);
 		rc = -ENODEV;
 		goto out_err;
 	}
--
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ