diff options
author | Vasily Averin <vvs@virtuozzo.com> | 2020-02-25 09:26:22 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-17 10:48:46 +0200 |
commit | 6415769223b072d59118ca3c63f0ca31a552a7e3 (patch) | |
tree | 273b33d7523fdb46313c718b1292820f069fc152 | |
parent | 1da36bedeab0a259d87e782b2adf34c18042a7cd (diff) | |
download | linux-stable-6415769223b072d59118ca3c63f0ca31a552a7e3.tar.gz linux-stable-6415769223b072d59118ca3c63f0ca31a552a7e3.tar.bz2 linux-stable-6415769223b072d59118ca3c63f0ca31a552a7e3.zip |
tpm: tpm2_bios_measurements_next should increase position index
commit f9bf8adb55cd5a357b247a16aafddf8c97b276e0 upstream.
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: 1f4aace60b0e ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/char/tpm/eventlog/tpm2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/tpm/eventlog/tpm2.c b/drivers/char/tpm/eventlog/tpm2.c index 41b9f6c92da7..aec49c925cee 100644 --- a/drivers/char/tpm/eventlog/tpm2.c +++ b/drivers/char/tpm/eventlog/tpm2.c @@ -143,6 +143,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) { @@ -167,7 +168,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; } |