diff options
author | Jarkko Sakkinen <jarkko@kernel.org> | 2021-01-29 00:56:19 +0100 |
---|---|---|
committer | Jarkko Sakkinen <jarkko@kernel.org> | 2021-02-16 09:40:28 +0100 |
commit | 5df16caada3fba3b21cb09b85cdedf99507f4ec1 (patch) | |
tree | 1c1afeec65b5a134bf62843d480bb85b6219f69a /README | |
parent | tpm/ppi: Constify static struct attribute_group (diff) | |
download | linux-5df16caada3fba3b21cb09b85cdedf99507f4ec1.tar.xz linux-5df16caada3fba3b21cb09b85cdedf99507f4ec1.zip |
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: 41ab999c80f1 ("tpm: Move tpm_get_random api into the TPM device driver")
Cc: stable@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.ibm.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Kent Yoder <key@linux.vnet.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions