Skip to contentSkip to conversation

Patch "tpm_eventlog.c: fix binary_bios_measurements" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message Apr 10, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tpm_eventlog.c: fix binary_bios_measurements

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tpm_eventlog.c-fix-binary_bios_measurements.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 186d124f07da193a8f47e491af85cb695d415f2f Mon Sep 17 00:00:00 2001

From: Harald Hoyer <[email protected]>
Date: Sat, 6 Feb 2016 15:44:42 +0100
Subject: tpm_eventlog.c: fix binary_bios_measurements

From: Harald Hoyer <[email protected]>

commit 186d124f07da193a8f47e491af85cb695d415f2f upstream.

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.

[[email protected]: fixed minor coding style issues and
renamed the local variable tempPtr as temp_ptr now that there is an excuse to do this.]

Fixes 0cc698af36ff ("vTPM: support little endian guests")
---
 drivers/char/tpm/tpm_eventlog.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/char/tpm/tpm_eventlog.c +10 -4
@@ -232,7 +232,7 @@ static int tpm_binary_bios_measurements_
 {
 	struct tcpa_event *event = v;
 	struct tcpa_event temp_event;
-	char *tempPtr;
+	char *temp_ptr;
 	int i;
 
 	memcpy(&temp_event, event, sizeof(struct tcpa_event));
@@ -242,10 +242,16 @@ static int tpm_binary_bios_measurements_
 	temp_event.event_type = do_endian_conversion(event->event_type);
 	temp_event.event_size = do_endian_conversion(event->event_size);
 
-	tempPtr = (char *)&temp_event;
+	temp_ptr = (char *) &temp_event;
 
-	for (i = 0; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
-		seq_putc(m, tempPtr[i]);
+	for (i = 0; i < (sizeof(struct tcpa_event) - 1) ; i++)
+		seq_putc(m, temp_ptr[i]);
+
+	temp_ptr = (char *) v;
+
+	for (i = (sizeof(struct tcpa_event) - 1);
+	     i < (sizeof(struct tcpa_event) + temp_event.event_size); i++)
+		seq_putc(m, temp_ptr[i]);
 
 	return 0;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/tpm_eventlog.c-fix-binary_bios_measurements.patch