lkml.org 
[lkml]   [2019]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] tpm: Actually fail on TPM errors during "get random"
From
Date
On Mon, 2019-04-01 at 11:52 -0700, Kees Cook wrote:
> @@ -559,6 +559,9 @@ int tpm1_get_random(struct tpm_chip *chip, u8
> *dest, size_t max)
> rc = total ? (int)total : -EIO;
> out:
> tpm_buf_destroy(&buf);
> +fail:
> + if (rc > 0)
> + rc = -EIO;
> return rc;
> }

No: same problem. If we're successful rc is set to total (a positive
integer) so as it falls through to fail: it's converted to -EIO which
means we never return success.

James

\
 
 \ /
  Last update: 2019-04-01 20:55    [W:0.037 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site