[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190208115031.GB11755@linux.intel.com>
Date: Fri, 8 Feb 2019 13:50:31 +0200
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Stefan Berger <stefanb@...ux.ibm.com>
Cc: Alexander Steffen <Alexander.Steffen@...ineon.com>,
linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
Peter Huewe <PeterHuewe@....de>,
Jason Gunthorpe <jgg@...pe.ca>,
Tomas Winkler <tomas.winkler@...el.com>,
Tadeusz Struk <tadeusz.struk@...el.com>,
Stefan Berger <stefanb@...ux.vnet.ibm.com>,
Nayna Jain <nayna@...ux.ibm.com>
Subject: Re: [PATCH v11 00/16] Remove nested TPM operations
On Thu, Feb 07, 2019 at 09:14:54PM -0500, Stefan Berger wrote:
> +EXPORT_SYMBOL_GPL(tpm_chip_start);
>
> /**
> * tpm_chip_stop() - power off the TPM
> @@ -131,7 +132,7 @@ void tpm_chip_stop(struct tpm_chip *chip)
> if (chip->ops->clk_enable)
> chip->ops->clk_enable(chip, false);
> }
> -
> +EXPORT_SYMBOL_GPL(tpm_chip_stop);
These are already fixed.
> /**
> * tpm_try_get_ops() - Get a ref to the tpm_chip
> @@ -474,8 +475,11 @@ static void tpm_del_char_device(struct tpm_chip *chip)
>
> /* Make the driver uncallable. */
> down_write(&chip->ops_sem);
> - if (chip->flags & TPM_CHIP_FLAG_TPM2)
> + if (chip->flags & TPM_CHIP_FLAG_TPM2) {
> + tpm_chip_start(chip, 0);
> tpm2_shutdown(chip, TPM2_SU_CLEAR);
> + tpm_chip_stop(chip, 0);
> + }
Thanks!
Needs to be also done in tpm_pm_suspend() but there it is also better to
take locks because in-kernel subsystem might be using TPM even user
space has been freezed (e.g. hibernate possibly in future).
mutex_lock(&chip->tpm_mutex);
if (!tpm_chip_start(chip, 0)) {
tpm2_shutdown(chip, TPM2_SU_CLEAR);
tpm_chip_stop(chip, 0);
}
mutex_unlock(&chip->tpm_mutex);
Fixed now.
> chip->ops = NULL;
> up_write(&chip->ops_sem);
> }
> diff --git a/drivers/char/tpm/tpm-interface.c
> b/drivers/char/tpm/tpm-interface.c
> index 02e8cffd1163..fcd845ad8c3c 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -124,6 +124,8 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip,
> void *buf, size_t bufsiz)
> dev_err(&chip->dev, "tpm_transmit: tpm_recv: error %d\n", rc);
> } else if (len < TPM_HEADER_SIZE || len != be32_to_cpu(header->length))
> rc = -EFAULT;
> + else
> + rc = 0;
Why is this needed?
/Jarkko
Powered by blists - more mailing lists