Skip to content

Commit

Permalink
tpm: tpm2_bios_measurements_next should increase position index
Browse files Browse the repository at this point in the history
If .next function does not change position index,
following .show function will repeat output related
to current position index.

For /sys/kernel/security/tpm0/binary_bios_measurements:
1) read after lseek beyound end of file generates whole last line.
2) read after lseek to middle of last line generates
expected end of last line and unexpected whole last line once again.

Cc: stable@vger.kernel.org # 4.19.x
Fixes: 1f4aace ("fs/seq_file.c: simplify seq_file iteration code ...")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
  • Loading branch information
Vasily Averin authored and Jarkko Sakkinen committed Mar 13, 2020
1 parent d7a47b9 commit f9bf8ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/tpm/eventlog/tpm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v,
size_t event_size;
void *marker;

(*pos)++;
event_header = log->bios_event_log;

if (v == SEQ_START_TOKEN) {
Expand All @@ -118,7 +119,6 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v,
if (((v + event_size) >= limit) || (event_size == 0))
return NULL;

(*pos)++;
return v;
}

Expand Down

0 comments on commit f9bf8ad

Please sign in to comment.