From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: "Winkler, Tomas" <tomas.winkler@intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Peter Huewe <peterhuewe@gmx.de>, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-integrity@vger.kernel.org"
<linux-integrity@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tpm: fix unused-value issues in tpm_try_transmit
Date: Mon, 15 Oct 2018 13:41:56 +0300 [thread overview]
Message-ID: <20181015104156.GA13408@linux.intel.com> (raw)
In-Reply-To: <5B8DA87D05A7694D9FA63FD143655C1B9D9EEC12@hasmsx109.ger.corp.intel.com>
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().
/Jarkko
next prev parent reply other threads:[~2018-10-15 18:26 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 [this message]
2018-10-15 11:18 ` Winkler, Tomas
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=20181015104156.GA13408@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).