提交 25a2fb24 编写于 作者: V Vasily Averin 提交者: Yang Yingliang

tpm: tpm2_bios_measurements_next should increase position index

stable inclusion
from linux-4.19.116
commit 6415769223b072d59118ca3c63f0ca31a552a7e3

--------------------------------

commit f9bf8adb 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: 1f4aace6 ("fs/seq_file.c: simplify seq_file iteration code ...")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283Signed-off-by: NVasily Averin <vvs@virtuozzo.com>
Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5836d6e8
...@@ -143,6 +143,7 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v, ...@@ -143,6 +143,7 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v,
size_t event_size; size_t event_size;
void *marker; void *marker;
(*pos)++;
event_header = log->bios_event_log; event_header = log->bios_event_log;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
...@@ -167,7 +168,6 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v, ...@@ -167,7 +168,6 @@ static void *tpm2_bios_measurements_next(struct seq_file *m, void *v,
if (((v + event_size) >= limit) || (event_size == 0)) if (((v + event_size) >= limit) || (event_size == 0))
return NULL; return NULL;
(*pos)++;
return v; return v;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册