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: <YqohTtlsRw8WJ8Y0@iki.fi>
Date:   Wed, 15 Jun 2022 21:13:34 +0300
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     LinoSanfilippo@....de
Cc:     peterhuewe@....de, jgg@...pe.ca, stefanb@...ux.vnet.ibm.com,
        linux@...ewoehner.de, linux-integrity@...r.kernel.org,
        linux-kernel@...r.kernel.org, l.sanfilippo@...bus.com,
        lukas@...ner.de, p.rosenberger@...bus.com
Subject: Re: [PATCH v5 04/10] tpm, tmp_tis: Claim locality before writing
 interrupt registers

On Fri, Jun 10, 2022 at 01:08:40PM +0200, LinoSanfilippo@....de wrote:
> From: Lino Sanfilippo <l.sanfilippo@...bus.com>
> 
> In tpm_tis_probe_single_irq interrupt registers TPM_INT_VECTOR,

nit: tpm_tis_probe_single_irq()

> TPM_INT_STATUS and TPM_INT_ENABLE are modified to setup the interrupts.
> Currently these modifications are done without holding a locality thus they
> have no effect. Fix this by claiming the (default) locality before the
> registers are written.
> 
> Signed-off-by: Lino Sanfilippo <l.sanfilippo@...bus.com>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index dee701609b80..718525fcadc0 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -756,30 +756,45 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
>  	}
>  	priv->irq = irq;
>  
> +	rc = request_locality(chip, 0);
> +	if (rc < 0)
> +		return rc;
> +
>  	rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality),
>  			   &original_int_vec);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		release_locality(chip, priv->locality);
>  		return rc;
> +	}
>  
>  	rc = tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality), irq);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		release_locality(chip, priv->locality);
>  		return rc;
> +	}
>  
>  	rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &int_status);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		release_locality(chip, priv->locality);
>  		return rc;
> +	}
>  
>  	/* Clear all existing */
>  	rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), int_status);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		release_locality(chip, priv->locality);
>  		return rc;
> +	}
>  
>  	/* Turn on */
>  	rc = tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality),
>  			     intmask | TPM_GLOBAL_INT_ENABLE);
> -	if (rc < 0)
> +	if (rc < 0) {
> +		release_locality(chip, priv->locality);
>  		return rc;
> +	}
>  
> +	release_locality(chip, priv->locality);
>  	clear_bit(TPM_TIS_IRQ_TESTED, &priv->irqtest_flags);
>  
>  	/* Generate an interrupt by having the core call through to
> -- 
> 2.36.1
> 

Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ