Page MenuHomeFreeBSD

D19713.diff
No OneTemporary

D19713.diff

Index: head/sys/dev/tpm/tpm20.h
===================================================================
--- head/sys/dev/tpm/tpm20.h
+++ head/sys/dev/tpm/tpm20.h
@@ -120,6 +120,7 @@
uint8_t *buf;
size_t pending_data_length;
+ lwpid_t owner_tid;
struct callout discard_buffer_callout;
#ifdef TPM_HARVEST
Index: head/sys/dev/tpm/tpm20.c
===================================================================
--- head/sys/dev/tpm/tpm20.c
+++ head/sys/dev/tpm/tpm20.c
@@ -77,6 +77,10 @@
callout_stop(&sc->discard_buffer_callout);
sx_xlock(&sc->dev_lock);
+ if (sc->owner_tid != uio->uio_td->td_tid) {
+ sx_xunlock(&sc->dev_lock);
+ return (EPERM);
+ }
bytes_to_transfer = MIN(sc->pending_data_length, uio->uio_resid);
if (bytes_to_transfer > 0) {
@@ -128,9 +132,11 @@
result = sc->transmit(sc, byte_count);
- if (result == 0)
+ if (result == 0) {
callout_reset(&sc->discard_buffer_callout,
TPM_READ_TIMEOUT / tick, tpm20_discard_buffer, sc);
+ sc->owner_tid = uio->uio_td->td_tid;
+ }
sx_xunlock(&sc->dev_lock);
return (result);

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 11, 2:42 PM (6 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29512628
Default Alt Text
D19713.diff (1 KB)

Event Timeline