In the Linux kernel, the following vulnerability has been resolved: tpm: Lock TPM chip in tpmpmsuspend() first Setting TPMCHIPFLAGSUSPENDED in the end of tpmpmsuspend() can be racy according, as this leaves window for tpmhwrngread() to be called while the operation is in progress. The recent bug report gives also evidence of this behaviour. Aadress this by locking the TPM chip before checking any chip->flags both in tpmpmsuspend() and tpmhwrngread(). Move TPMCHIPFLAGSUSPENDED check inside tpmgetrandom() so that it will be always checked only when the lock is reserved.