mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
Add a cv_wait to the TPM2.0 harvesting function
Harvesting has to compete for the TPM chip with userspace. Before this change the callout could hijack an unread buffer causing a userspace call to the TPM to fail. Submitted by: Kornel Duleba <mindal@semihalf.com> Reviewed by: delphij Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D19712
This commit is contained in:
parent
f806eb62a4
commit
3a3e5039b9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345842
@ -263,6 +263,8 @@ tpm20_harvest(void *arg)
|
||||
|
||||
sc = arg;
|
||||
sx_xlock(&sc->dev_lock);
|
||||
while (sc->pending_data_length != 0)
|
||||
cv_wait(&sc->buf_cv, &sc->dev_lock);
|
||||
|
||||
memcpy(sc->buf, cmd, sizeof(cmd));
|
||||
result = sc->transmit(sc, sizeof(cmd));
|
||||
|
Loading…
Reference in New Issue
Block a user