* [PATCH] tpm: Do not print an error message when doing TPM auto startup
@ 2016-11-21 18:31 Jason Gunthorpe
[not found] ` <20161121183109.GA18088-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2016-11-21 18:31 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: tpmdd-devel, linux-security-module, Ed Swierk
This is a regression when this code was reworked and made the error
print unconditional. The original code deliberately suppressed printing
of the first error message so it could quietly sense
TPM_ERR_INVALID_POSTINIT.
Fixes: a502feb67b47 ("tpm: Clean up reading of timeout and duration capabilities")
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
drivers/char/tpm/tpm-interface.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index a2688ac2b48f3c..c90f4f6d7871be 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -523,8 +523,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
return 0;
}
- rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
- "attempting to determine the timeouts");
+ rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, NULL);
if (rc == TPM_ERR_INVALID_POSTINIT) {
/* The TPM is not started, we are the first to talk to it.
Execute a startup command. */
@@ -535,8 +534,12 @@ int tpm_get_timeouts(struct tpm_chip *chip)
rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
"attempting to determine the timeouts");
}
- if (rc)
+ if (rc) {
+ dev_err(&chip->dev,
+ "A TPM error (%zd) occurred attempting to determine the timeouts\n",
+ rc);
return rc;
+ }
old_timeout[0] = be32_to_cpu(cap.timeout.a);
old_timeout[1] = be32_to_cpu(cap.timeout.b);
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tpm: Do not print an error message when doing TPM auto startup
[not found] ` <20161121183109.GA18088-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-11-21 20:42 ` Jarkko Sakkinen
2017-01-06 21:25 ` Jason Gunthorpe
0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2016-11-21 20:42 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Mon, Nov 21, 2016 at 11:31:09AM -0700, Jason Gunthorpe wrote:
> This is a regression when this code was reworked and made the error
> print unconditional. The original code deliberately suppressed printing
> of the first error message so it could quietly sense
> TPM_ERR_INVALID_POSTINIT.
>
> Fixes: a502feb67b47 ("tpm: Clean up reading of timeout and duration capabilities")
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Thanks for spotting this out. I'll apply this tomorrow (i.e. not
tonight) as it does not endager stability in anyway as I test the
other fixes.
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
/Jarkko
> ---
> drivers/char/tpm/tpm-interface.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index a2688ac2b48f3c..c90f4f6d7871be 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -523,8 +523,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
> return 0;
> }
>
> - rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
> - "attempting to determine the timeouts");
> + rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, NULL);
> if (rc == TPM_ERR_INVALID_POSTINIT) {
> /* The TPM is not started, we are the first to talk to it.
> Execute a startup command. */
> @@ -535,8 +534,12 @@ int tpm_get_timeouts(struct tpm_chip *chip)
> rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
> "attempting to determine the timeouts");
> }
> - if (rc)
> + if (rc) {
> + dev_err(&chip->dev,
> + "A TPM error (%zd) occurred attempting to determine the timeouts\n",
> + rc);
> return rc;
> + }
>
> old_timeout[0] = be32_to_cpu(cap.timeout.a);
> old_timeout[1] = be32_to_cpu(cap.timeout.b);
> --
> 2.1.4
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tpm: Do not print an error message when doing TPM auto startup
2016-11-21 20:42 ` Jarkko Sakkinen
@ 2017-01-06 21:25 ` Jason Gunthorpe
2017-01-09 23:08 ` Jarkko Sakkinen
0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2017-01-06 21:25 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: tpmdd-devel, linux-security-module, Ed Swierk
On Mon, Nov 21, 2016 at 10:42:11PM +0200, Jarkko Sakkinen wrote:
> On Mon, Nov 21, 2016 at 11:31:09AM -0700, Jason Gunthorpe wrote:
> > This is a regression when this code was reworked and made the error
> > print unconditional. The original code deliberately suppressed printing
> > of the first error message so it could quietly sense
> > TPM_ERR_INVALID_POSTINIT.
> >
> > Fixes: a502feb67b47 ("tpm: Clean up reading of timeout and duration capabilities")
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>
> Thanks for spotting this out. I'll apply this tomorrow (i.e. not
> tonight) as it does not endager stability in anyway as I test the
> other fixes.
>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Hey Jarkko, I couldn't find this patch in your trees and it didn't
make 4.10-rc1, can you please pick it up?
https://patchwork.kernel.org/patch/9439931/
> /Jarkko
>
> > drivers/char/tpm/tpm-interface.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> > index a2688ac2b48f3c..c90f4f6d7871be 100644
> > +++ b/drivers/char/tpm/tpm-interface.c
> > @@ -523,8 +523,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
> > return 0;
> > }
> >
> > - rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
> > - "attempting to determine the timeouts");
> > + rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, NULL);
> > if (rc == TPM_ERR_INVALID_POSTINIT) {
> > /* The TPM is not started, we are the first to talk to it.
> > Execute a startup command. */
> > @@ -535,8 +534,12 @@ int tpm_get_timeouts(struct tpm_chip *chip)
> > rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
> > "attempting to determine the timeouts");
> > }
> > - if (rc)
> > + if (rc) {
> > + dev_err(&chip->dev,
> > + "A TPM error (%zd) occurred attempting to determine the timeouts\n",
> > + rc);
> > return rc;
> > + }
> >
> > old_timeout[0] = be32_to_cpu(cap.timeout.a);
> > old_timeout[1] = be32_to_cpu(cap.timeout.b);
--
Jason Gunthorpe <jgunthorpe@obsidianresearch.com> (780)4406067x832
Chief Technology Officer, Obsidian Research Corp Edmonton, Canada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tpm: Do not print an error message when doing TPM auto startup
2017-01-06 21:25 ` Jason Gunthorpe
@ 2017-01-09 23:08 ` Jarkko Sakkinen
0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2017-01-09 23:08 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: tpmdd-devel, linux-security-module, Ed Swierk
On Fri, Jan 06, 2017 at 02:25:51PM -0700, Jason Gunthorpe wrote:
> On Mon, Nov 21, 2016 at 10:42:11PM +0200, Jarkko Sakkinen wrote:
> > On Mon, Nov 21, 2016 at 11:31:09AM -0700, Jason Gunthorpe wrote:
> > > This is a regression when this code was reworked and made the error
> > > print unconditional. The original code deliberately suppressed printing
> > > of the first error message so it could quietly sense
> > > TPM_ERR_INVALID_POSTINIT.
> > >
> > > Fixes: a502feb67b47 ("tpm: Clean up reading of timeout and duration capabilities")
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> >
> > Thanks for spotting this out. I'll apply this tomorrow (i.e. not
> > tonight) as it does not endager stability in anyway as I test the
> > other fixes.
> >
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>
> Hey Jarkko, I couldn't find this patch in your trees and it didn't
> make 4.10-rc1, can you please pick it up?
>
> https://patchwork.kernel.org/patch/9439931/
My bad. It's applied now. Can you check that everything looks good
and I'll ask James to take the fixes that I have to 4.10?
/Jarkko
>
> > /Jarkko
> >
> > > drivers/char/tpm/tpm-interface.c | 9 ++++++---
> > > 1 file changed, 6 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> > > index a2688ac2b48f3c..c90f4f6d7871be 100644
> > > +++ b/drivers/char/tpm/tpm-interface.c
> > > @@ -523,8 +523,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
> > > return 0;
> > > }
> > >
> > > - rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
> > > - "attempting to determine the timeouts");
> > > + rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, NULL);
> > > if (rc == TPM_ERR_INVALID_POSTINIT) {
> > > /* The TPM is not started, we are the first to talk to it.
> > > Execute a startup command. */
> > > @@ -535,8 +534,12 @@ int tpm_get_timeouts(struct tpm_chip *chip)
> > > rc = tpm_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap,
> > > "attempting to determine the timeouts");
> > > }
> > > - if (rc)
> > > + if (rc) {
> > > + dev_err(&chip->dev,
> > > + "A TPM error (%zd) occurred attempting to determine the timeouts\n",
> > > + rc);
> > > return rc;
> > > + }
> > >
> > > old_timeout[0] = be32_to_cpu(cap.timeout.a);
> > > old_timeout[1] = be32_to_cpu(cap.timeout.b);
>
> --
> Jason Gunthorpe <jgunthorpe@obsidianresearch.com> (780)4406067x832
> Chief Technology Officer, Obsidian Research Corp Edmonton, Canada
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-09 23:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 18:31 [PATCH] tpm: Do not print an error message when doing TPM auto startup Jason Gunthorpe
[not found] ` <20161121183109.GA18088-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-21 20:42 ` Jarkko Sakkinen
2017-01-06 21:25 ` Jason Gunthorpe
2017-01-09 23:08 ` Jarkko Sakkinen
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).