Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334099

[PATCH 3/3] tpm_eventlog.c: fix binary_bios_measurements

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] tpm_eventlog.c: fix binary_bios_measurements
Date 2016-02-15 02:50 +0100
Message-ID <r2gsx-2w1-9@gated-at.bofh.it> (permalink)
References <r2gsx-2w1-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Harald Hoyer <harald@redhat.com>

The commit 0cc698af36ff ("vTPM: support little endian guests") copied
the event, but without the event data, did an endian conversion on the
size and tried to output the event data from the copied version, which
has only have one byte of the data, resulting in garbage event data.

Signed-off-by: Harald Hoyer <harald@redhat.com>
Fixes: 0cc698af36ff ("vTPM: support little endian guests")
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
cc: stable@vger.kernel.org
---
 drivers/char/tpm/tpm_eventlog.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
index bd72fb0..27fc887 100644
--- a/drivers/char/tpm/tpm_eventlog.c
+++ b/drivers/char/tpm/tpm_eventlog.c
@@ -242,9 +242,15 @@ static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
 	temp_event.event_type = do_endian_conversion(event->event_type);
 	temp_event.event_size = do_endian_conversion(event->event_size);
 
-	tempPtr = (char *)&temp_event;
+	tempPtr = (char *) &temp_event;
 
-	for (i = 0; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
+	for (i = 0; i < (sizeof(struct tcpa_event) - 1) ; i++)
+		seq_putc(m, tempPtr[i]);
+
+	tempPtr = (char *) v;
+
+	for (i = (sizeof(struct tcpa_event) - 1);
+	     i < (sizeof(struct tcpa_event) + temp_event.event_size); i++)
 		seq_putc(m, tempPtr[i]);
 
 	return 0;
-- 
2.7.0

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] Remaining fixes for v4.5 (post tpmdd-next-20160120) Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-15 02:50 +0100
  [PATCH 1/3] tpm: fix: keep auth session intact after unseal operation Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-15 02:50 +0100
  [PATCH 3/3] tpm_eventlog.c: fix binary_bios_measurements Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-02-15 02:50 +0100

csiph-web