--- - branch: MAIN date: Sun Jan 16 20:24:34 UTC 2022 files: - new: '1.24' old: '1.23' path: src/sys/dev/ic/tpm.c pathrev: src/sys/dev/ic/tpm.c@1.24 type: modified id: 20220116T202434Z.d3a69872b57887702b6d7ee8ab2ade75f14f2f15 log: | tpm(4): Fix suspend and rework I/O transaction lock. Use sc->sc_lock over individual I/O transactions, not open/close of the whole device. This way there is a bounded time before the tpm is unbusied even if userland is getting at it, so userland can't hold up suspend indefinitely. Of course, the tpm might be suspended and resumed in the middle of the user's session this way -- tough. This limits the response buffer to 1024 bytes -- which is already a bit hefty to have on the stack (but it's probably not very deep on the stack from userland so maybe not a big deal). If it turns out we need more, we can use kmem to allocate a buffer on the heap, with the caveat that it might fail. This is necessary so that suspend doesn't block indefinitely on uiomove in tpmread. module: src subject: 'CVS commit: src/sys/dev/ic' unixtime: '1642364674' user: riastradh