summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm_ibmvtpm.h
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2015-12-09 16:52:01 +0300
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2015-12-20 16:27:12 +0300
commit6674ff145eef1f158e3d1d065cb1e19f315d909b (patch)
tree82eb29e89966d0638edb5edbd0991a7ff5a2320e /drivers/char/tpm/tpm_ibmvtpm.h
parentb8ba1e744445d65dad7dd61db909e7f2b89df35e (diff)
downloadlinux-6674ff145eef1f158e3d1d065cb1e19f315d909b.tar.xz
tpm_ibmvtpm: properly handle interrupted packet receptions
When the TPM response reception is interrupted in the wait_event_interruptable call, the TPM is still busy processing the command and will only deliver the response later. So we have to wait for an outstanding response before sending a new request to avoid trying to put a 2nd request into the CRQ. Also reset the res_len before sending a command so we will end up in that wait_event_interruptable() waiting for the response rather than reading the command packet as a response. The easiest way to trigger the problem is to run the following cd /sys/device/vio/71000004 while :; cat pcrs >/dev/null; done And press Ctrl-C. This will then display an error tpm_ibmvtpm 71000004: tpm_transmit: tpm_recv: error -4 followed by several other errors once interaction with the TPM resumes. tpm_ibmvtpm 71000004: A TPM error (101) occurred attempting to determine the number of PCRS. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Tested-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Ashley Lai <ashley@ashleylai.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Acked-by: Peter Huewe <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char/tpm/tpm_ibmvtpm.h')
-rw-r--r--drivers/char/tpm/tpm_ibmvtpm.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h
index 6af92890518f..91dfe766d080 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.h
+++ b/drivers/char/tpm/tpm_ibmvtpm.h
@@ -45,6 +45,7 @@ struct ibmvtpm_dev {
wait_queue_head_t wq;
u16 res_len;
u32 vtpm_version;
+ bool tpm_processing_cmd;
};
#define CRQ_RES_BUF_SIZE PAGE_SIZE