lkml.org 
[lkml]   [2020]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.5 122/257] tpm: tpm2_bios_measurements_next should increase position index
    Date
    From: Vasily Averin <vvs@virtuozzo.com>

    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>

    ---
    drivers/char/tpm/eventlog/tpm2.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/char/tpm/eventlog/tpm2.c
    +++ b/drivers/char/tpm/eventlog/tpm2.c
    @@ -94,6 +94,7 @@ static void *tpm2_bios_measurements_next
    size_t event_size;
    void *marker;

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

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

    - (*pos)++;
    return v;
    }


    \
     
     \ /
      Last update: 2020-04-16 15:56    [W:4.078 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site