tpm-emulator: protect concurrent ctrl_chr access
commit17b1af773ed81a9167abfa09749ab92bd05740b0
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 6 Nov 2017 18:39:22 +0000 (6 19:39 +0100)
committerStefan Berger <Stefan Berger stefanb@linux.vnet.ibm.com>
Wed, 15 Nov 2017 11:47:35 +0000 (15 06:47 -0500)
tree86abed0e203dc354e5507b429674c13b5e20101d
parent83e83c34b2102153682729531b9c9d3e6659f037
tpm-emulator: protect concurrent ctrl_chr access

The control chardev is being used from the data thread to set the
locality of the next request. Altough the chr has a write mutex, we
may potentially read the reply from another thread request.

Add a mutex to protect from concurrent control commands.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
hw/tpm/tpm_emulator.c