]> git.proxmox.com Git - swtpm.git/commit
swtpm: cuse: Extend usage of FILE_OPS_LOCK to protect a reading thread
authorStefan Berger <stefanb@linux.ibm.com>
Tue, 9 Aug 2022 23:58:33 +0000 (19:58 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Fri, 12 Aug 2022 12:54:50 +0000 (08:54 -0400)
commitc4adfa3e57470d6005554e4e7dacec14cbc127e4
tree749bd079c9c6993fb933a46312d8e490155f8c77
parent54de243efd11e93e9d1c06efbe19f36e456948d4
swtpm: cuse: Extend usage of FILE_OPS_LOCK to protect a reading thread

Extend usage of the FILE_OPS_LOCK to prevent other threads from reading or
writing commands or doing ioctls while the current thread is reading a
response. This prevents a race condition where ptm_read_offset is set to 0
by a thread writing a new command to the device while the current thread
is reading a response from the device and needs this offset.

Resolves: https://github.com/stefanberger/swtpm/issues/725
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm/cuse_tpm.c