]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
tpm_ibmvtpm: properly handle interrupted packet receptions
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Wed, 9 Dec 2015 13:52:01 +0000 (08:52 -0500)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:26:17 +0000 (10:26 +0100)
commite99165f9f690e10a90ad4fb471083552249a5649
tree015e8063acbc3ee35b306b04c3237e4695e024b3
parent72ce3745a71fb309af007a5fbbbebd06ab55f818
tpm_ibmvtpm: properly handle interrupted packet receptions

BugLink: http://bugs.launchpad.net/bugs/1398274
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>
(cherry picked from commit 6674ff145eef1f158e3d1d065cb1e19f315d909b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/char/tpm/tpm_ibmvtpm.c
drivers/char/tpm/tpm_ibmvtpm.h