Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KEYS: trusted: Fix incorrect handling of tpm_get_random()
When tpm_get_random() was introduced, it defined the following API for the return value: 1. A positive value tells how many bytes of random data was generated. 2. A negative value on error. However, in the call sites the API was used incorrectly, i.e. as it would only return negative values and otherwise zero. Returning he positive read counts to the user space does not make any possible sense. Fix this by returning -EIO when tpm_get_random() returns a positive value. Fixes: 41ab999 ("tpm: Move tpm_get_random api into the TPM device driver") Cc: [email protected] Cc: Mimi Zohar <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: David Howells <[email protected]> Cc: Kent Yoder <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Mimi Zohar <[email protected]>
- Loading branch information