OSDN Git Service

tpm: ibmvtpm: Wait for buffer to be set before proceeding
authorStefan Berger <stefanb@linux.ibm.com>
Thu, 12 Mar 2020 15:53:31 +0000 (11:53 -0400)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Sun, 15 Mar 2020 18:12:52 +0000 (20:12 +0200)
commitd8d74ea3c00214aee1e1826ca18e77944812b9b4
tree9bc7320e48f530bba9f6311f049e8b4c4619b51d
parent5cb2ace90deb6df9c90172f904fb4a12ee4d443a
tpm: ibmvtpm: Wait for buffer to be set before proceeding

Synchronize with the results from the CRQs before continuing with
the initialization. This avoids trying to send TPM commands while
the rtce buffer has not been allocated, yet.

This patch fixes an existing race condition that may occurr if the
hypervisor does not quickly respond to the VTPM_GET_RTCE_BUFFER_SIZE
request sent during initialization and therefore the ibmvtpm->rtce_buf
has not been allocated at the time the first TPM command is sent.

Fixes: 132f76294744 ("drivers/char/tpm: Add new device driver to support IBM vTPM")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Acked-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: Nayna Jain <nayna@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm_ibmvtpm.c
drivers/char/tpm/tpm_ibmvtpm.h