Re: [PATCH v11 00/16] Remove nested TPM operations

From: Stefan Berger
Date: Fri Feb 08 2019 - 07:22:58 EST


On 2/8/19 6:50 AM, Jarkko Sakkinen wrote:
On Thu, Feb 07, 2019 at 09:14:54PM -0500, Stefan Berger wrote:

ÂÂÂÂ 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?

Because it holds a non-zero value, which is wrong at this point. Below it is:

return rc ? rc : len;

It will always return that rc and never 'len'.

It's not just needed for bisecting. I still need it with your latest tree. That's the only change I need with my current testing of tpm_vtpm_proxy, TIS + TPM 1.2 , TIS + TPM 2.0 , and CRB + TPM 2.0 (with QEMU :-) ).

ÂÂ Stefan