All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Winkler, Tomas" <tomas.winkler@intel.com>
To: "jarkko.sakkinen@linux.intel.com" <jarkko.sakkinen@linux.intel.com>
Cc: "linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>,
	"gustavo@embeddedor.com" <gustavo@embeddedor.com>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"peterhuewe@gmx.de" <peterhuewe@gmx.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] tpm: fix unused-value issues in tpm_try_transmit
Date: Mon, 15 Oct 2018 11:18:43 +0000	[thread overview]
Message-ID: <1539602081.11953.4.camel@intel.com> (raw)
In-Reply-To: <20181015104156.GA13408@linux.intel.com>

On Mon, 2018-10-15 at 13:41 +0300, Jarkko Sakkinen wrote:
> On Thu, Oct 11, 2018 at 01:27:58PM +0000, Winkler, Tomas wrote:
> > > 
> > > On Wed, Oct 10, 2018 at 08:06:38AM -0600, Jason Gunthorpe wrote:
> > > > On Wed, Oct 10, 2018 at 03:38:17PM +0200, Gustavo A. R. Silva wrote:
> > > > > Currently, there are some values assigned to variable *rc*, which
> > > > > are never actually used in any computation, because such variable is
> > > > > updated at line 550, before they can be used:
> > > > > 
> > > > > 549out:
> > > > > 550        rc = tpm_go_idle(chip, flags);
> > > > > 551        if (rc)
> > > > > 552                goto out;
> > > > > 
> > > > > Fix this by removing such assignments.
> > > > 
> > > > Should this be done by not quashing rc during the error unwind rather
> > > > than dropping the errors?
> > > 
> > > Yeah.`
> > > 
> > > Wondering if tpm_go_idle() should simply be a void-function i.e. issue just a
> > > warning inside (disclaimer: did not revisit its code when writing this).
> > 
> > We did have rather a long discussion about it when it was merged.
> > There are two flows that may crash 
> > rc = tpm2_commit_space()
> > 
> > but you still can need to 
> > 
> > rc  = go_idle()  
> > 
> > which also may crash which may override the previous value. 
> > 
> > Frankly the second one is fatal, the stack will go out of sync.
> > We may do void here as the stack will crash in a subsequent command. 
> > 
> > The 'goto out' is quite a  bug, probably caused by code movement.
> 
> I just looked at the code properly and noticed that there is a regression
> caused by 627448e85c76 ("tpm: separate cmd_ready/go_idle from
> runtime_pm") i.e. when tpm_go_idle() fails it loops back and retries
> tpm_go_idle().
Yes, that's what I said, this part code was moved forth but no the
label.
Tomas

      reply	other threads:[~2018-10-15 19:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 13:38 [PATCH] tpm: fix unused-value issues in tpm_try_transmit Gustavo A. R. Silva
2018-10-10 14:06 ` Jason Gunthorpe
2018-10-11 12:01   ` Jarkko Sakkinen
2018-10-11 13:27     ` Winkler, Tomas
2018-10-15 10:41       ` Jarkko Sakkinen
2018-10-15 11:18         ` Winkler, Tomas [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=1539602081.11953.4.camel@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /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.