tpm: vtpm_proxy: Avoid reading host log when using a virtual device
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 10 Mar 2021 22:19:16 +0000 (17:19 -0500)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 14 Apr 2021 13:30:30 +0000 (16:30 +0300)
Avoid allocating memory and reading the host log when a virtual device
is used since this log is of no use to that driver. A virtual
device can be identified through the flag TPM_CHIP_FLAG_VIRTUAL, which
is only set for the tpm_vtpm_proxy driver.

Cc: stable@vger.kernel.org
Fixes: 6f99612e2500 ("tpm: Proxy driver for supporting multiple emulated TPMs")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/eventlog/common.c

index 7460f230bae4c6dbc8ed68acfbb42200a0c5a9b0..8512ec76d5260d6788686b33bd3dc79db34fa937 100644 (file)
@@ -107,6 +107,9 @@ void tpm_bios_log_setup(struct tpm_chip *chip)
        int log_version;
        int rc = 0;
 
+       if (chip->flags & TPM_CHIP_FLAG_VIRTUAL)
+               return;
+
        rc = tpm_read_log(chip);
        if (rc < 0)
                return;