All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Kees Cook <keescook@chromium.org>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Phil Baker <baker1tex@gmail.com>,
	Craig Robson <craig@zhatt.com>, Laura Abbott <labbott@redhat.com>,
	Tomas Winkler <tomas.winkler@intel.com>,
	Nayna Jain <nayna@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, Peter Huewe <peterhuewe@gmx.de>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH v2] tpm: Actually fail on TPM errors during "get random"
Date: Mon, 01 Apr 2019 11:54:43 -0700	[thread overview]
Message-ID: <1554144883.3029.20.camel@HansenPartnership.com> (raw)
In-Reply-To: <20190401185219.GA22215@beast>

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


      reply	other threads:[~2019-04-01 18:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 18:52 [PATCH v2] tpm: Actually fail on TPM errors during "get random" Kees Cook
2019-04-01 18:54 ` James Bottomley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554144883.3029.20.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=arnd@arndb.de \
    --cc=baker1tex@gmail.com \
    --cc=craig@zhatt.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=keescook@chromium.org \
    --cc=labbott@redhat.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nayna@linux.vnet.ibm.com \
    --cc=peterhuewe@gmx.de \
    --cc=tomas.winkler@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.