Message ID | 3b24cec6-efb9-8dd4-fa1e-19e04798b067@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tpm: seq_file .next functions should increase position index | expand |
On Thu, 2020-01-23 at 10:48 +0300, Vasily Averin wrote: > 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> * Should be "tpm: tpm1_bios_measurements_next should increase position index" * Sentences in English start with a capital letter. * Should probably have Fixes tag. * Shoud have "Cc: stable@vger.kernel.org" tag. Same remarks for TPM2 patch. /Jarkko
On Wed, 2020-01-29 at 15:23 +0200, Jarkko Sakkinen wrote: > On Thu, 2020-01-23 at 10:48 +0300, Vasily Averin wrote: > > 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> > > * Should be "tpm: tpm1_bios_measurements_next should increase position index" > * Sentences in English start with a capital letter. > * Should probably have Fixes tag. > * Shoud have "Cc: stable@vger.kernel.org" tag. > > Same remarks for TPM2 patch. * Shoud have explanation what kind of output is generated without the fix. "Unexpected output" is does not document the regression. /Jarkko
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; }
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(-)