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: <D3Z3W2PZDU7C.4CBZUBZYY0RS@kernel.org>
Date: Fri, 06 Sep 2024 12:50:00 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "Stefan Wahren" <wahrenst@....net>, "Peter Huewe" <peterhuewe@....de>,
 "Jason Gunthorpe" <jgg@...pe.ca>
Cc: <linux-integrity@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 "Stefan Berger" <stefanb@...ux.ibm.com>
Subject: Re: [PATCH RFC 2/2] tpm: tpm_tis: Provide error messages in
 tpm_tis_core_init

On Fri Sep 6, 2024 at 9:09 AM EEST, Stefan Wahren wrote:
> 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

No thanks. It not only adds helpful messages but has potential to add
unwanted merge conflicts.

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ