Re: [PATCH v5 1/3] KEYS: trusted: Fix incorrect handling of tpm_get_random()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2021-01-29 at 01:56 +0200, jarkko@xxxxxxxxxx wrote:
> From: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxx
> Cc: Mimi Zohar <zohar@xxxxxxxxxxxxx>
> Cc: "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
> Cc: David Howells <dhowells@xxxxxxxxxx>
> Cc: Kent Yoder <key@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>

thanks,

Reviewed-by: Mimi Zohar <zohar@xxxxxxxxxxxxx>




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux