linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tpm1_bios_measurements_next should increase position index
@ 2020-01-23  7:48 Vasily Averin
  2020-01-29 13:23 ` Jarkko Sakkinen
  0 siblings, 1 reply; 13+ messages in thread
From: Vasily Averin @ 2020-01-23  7:48 UTC (permalink / raw)
  To: linux-integrity; +Cc: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe

if seq_file .next fuction does not change position index,
read after non-zero llseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 drivers/char/tpm/eventlog/tpm1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
index 739b1d9..2c96977 100644
--- a/drivers/char/tpm/eventlog/tpm1.c
+++ b/drivers/char/tpm/eventlog/tpm1.c
@@ -115,6 +115,7 @@ static void *tpm1_bios_measurements_next(struct seq_file *m, void *v,
 	u32 converted_event_size;
 	u32 converted_event_type;
 
+	(*pos)++;
 	converted_event_size = do_endian_conversion(event->event_size);
 
 	v += sizeof(struct tcpa_event) + converted_event_size;
@@ -132,7 +133,6 @@ static void *tpm1_bios_measurements_next(struct seq_file *m, void *v,
 	    ((v + sizeof(struct tcpa_event) + converted_event_size) > limit))
 		return NULL;
 
-	(*pos)++;
 	return v;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-02-25 10:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23  7:48 [PATCH 1/2] tpm1_bios_measurements_next should increase position index Vasily Averin
2020-01-29 13:23 ` Jarkko Sakkinen
2020-01-29 13:25   ` Jarkko Sakkinen
2020-01-30 10:23     ` [PATCH v2 0/2] tpm: seq_file .next functions " Vasily Averin
2020-01-30 10:23     ` [PATCH v2 1/2] tpm: tpm1_bios_measurements_next " Vasily Averin
2020-01-30 10:23     ` [PATCH v2 2/2] tpm: tpm2_bios_measurements_next " Vasily Averin
2020-02-01 17:03       ` Jarkko Sakkinen
2020-02-03  5:14         ` Vasily Averin
2020-02-05 22:03           ` Jarkko Sakkinen
2020-02-25  6:26             ` [PATCH v3 1/2] tpm: tpm1_bios_measurements_next " Vasily Averin
2020-02-25 10:27               ` Jarkko Sakkinen
2020-02-25 10:29                 ` Jarkko Sakkinen
2020-02-25  6:26             ` [PATCH v3 2/2] tpm: tpm2_bios_measurements_next " Vasily Averin

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).