linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Garrett <mjg59@google.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Jones <pjones@redhat.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Roberto Sassu <roberto.sassu@huawei.com>,
	Bartosz Szczepanek <bsz@semihalf.com>,
	Lyude Paul <lyude@redhat.com>,
	linux-efi <linux-efi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] efi+tpm: don't traverse an event log with no events
Date: Mon, 26 Aug 2019 10:45:35 -0700	[thread overview]
Message-ID: <CACdnJuu7Sernq__mU-t0e9MYs35szCGZHxn-qYfz--fkm59i6Q@mail.gmail.com> (raw)
In-Reply-To: <20190826163020.e7sahr3irqwwneey@linux.intel.com>

On Mon, Aug 26, 2019 at 9:30 AM Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Mon, Aug 26, 2019 at 11:30:28AM -0400, Peter Jones wrote:
> > When there are no entries to put into the final event log, some machines
> > will return the template they would have populated anyway.  In this case
> > the nr_events field is 0, but the rest of the log is just garbage.
> >
> > This patch stops us from trying to iterate the table with
> > __calc_tpm2_event_size() when the number of events in the table is 0.
> >
> > Signed-off-by: Peter Jones <pjones@redhat.com>
> > Tested-by: Lyude Paul <lyude@redhat.com>
> > ---
> >  drivers/firmware/efi/tpm.c | 14 +++++++++-----
> >  1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
> > index 1d3f5ca3eaa..be51ed17c6e 100644
> > --- a/drivers/firmware/efi/tpm.c
> > +++ b/drivers/firmware/efi/tpm.c
> > @@ -75,11 +75,15 @@ int __init efi_tpm_eventlog_init(void)
> >               goto out;
> >       }
> >
> > -     tbl_size = tpm2_calc_event_log_size((void *)efi.tpm_final_log
> > -                                         + sizeof(final_tbl->version)
> > -                                         + sizeof(final_tbl->nr_events),
> > -                                         final_tbl->nr_events,
> > -                                         log_tbl->log);
> > +     tbl_size = 0;
> > +     if (final_tbl->nr_events != 0) {
> > +             void *events = (void *)efi.tpm_final_log
> > +                             + sizeof(final_tbl->version)
> > +                             + sizeof(final_tbl->nr_events);
> > +             tbl_size = tpm2_calc_event_log_size(events,
> > +                                                 final_tbl->nr_events,
> > +                                                 log_tbl->log);
> > +     }
>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Acked-by: Matthew Garrett <mjg59@google.com>

  reply	other threads:[~2019-08-26 17:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 15:30 [PATCH 1/2] efi+tpm: Don't access event->count when it isn't mapped Peter Jones
2019-08-26 15:30 ` [PATCH 2/2] efi+tpm: don't traverse an event log with no events Peter Jones
2019-08-26 16:30   ` Jarkko Sakkinen
2019-08-26 17:45     ` Matthew Garrett [this message]
2019-08-31 16:46   ` Ard Biesheuvel
2019-08-26 16:28 ` [PATCH 1/2] efi+tpm: Don't access event->count when it isn't mapped Jarkko Sakkinen
2019-08-26 17:44   ` Matthew Garrett
2019-08-27 11:03     ` Jarkko Sakkinen
2019-08-27 13:41       ` Jarkko Sakkinen
2019-08-27 16:00         ` Matthew Garrett
2019-08-27 22:11         ` Peter Jones
2019-08-29 13:21           ` Jarkko Sakkinen
2019-08-31 16:11 ` Ard Biesheuvel

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=CACdnJuu7Sernq__mU-t0e9MYs35szCGZHxn-qYfz--fkm59i6Q@mail.gmail.com \
    --to=mjg59@google.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bsz@semihalf.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=pjones@redhat.com \
    --cc=roberto.sassu@huawei.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).