linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: peterhuewe@gmx.de, jarkko@kernel.org
Cc: jgg@ziepe.ca, linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Stefan Berger <stefanb@linux.ibm.com>
Subject: [PATCH v2 3/3] tpm: vtpm_proxy: Avoid reading host log when using a virtual device
Date: Wed, 10 Mar 2021 17:19:16 -0500	[thread overview]
Message-ID: <20210310221916.356716-4-stefanb@linux.ibm.com> (raw)
In-Reply-To: <20210310221916.356716-1-stefanb@linux.ibm.com>

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.

Fixes: 6f99612e2500 ("tpm: Proxy driver for supporting multiple emulated TPMs")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 drivers/char/tpm/eventlog/common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/char/tpm/eventlog/common.c b/drivers/char/tpm/eventlog/common.c
index 7460f230bae4..8512ec76d526 100644
--- a/drivers/char/tpm/eventlog/common.c
+++ b/drivers/char/tpm/eventlog/common.c
@@ -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;
-- 
2.29.2


  parent reply	other threads:[~2021-03-10 22:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 22:19 [PATCH v2 0/3] Fix bugs related to TPM2 event log Stefan Berger
2021-03-10 22:19 ` [PATCH v2 1/3] tpm: efi: Use local variable for calculating final log size Stefan Berger
2021-03-10 23:14   ` Jarkko Sakkinen
2021-03-10 23:21   ` Jarkko Sakkinen
2021-03-10 23:24     ` Jarkko Sakkinen
2021-03-11 14:02       ` Stefan Berger
2021-03-12 16:54         ` Jarkko Sakkinen
2021-03-10 22:19 ` [PATCH v2 2/3] tpm: acpi: Check eventlog signature before using it Stefan Berger
2021-03-10 23:13   ` Jarkko Sakkinen
2021-03-10 22:19 ` Stefan Berger [this message]
2021-03-10 23:04   ` [PATCH v2 3/3] tpm: vtpm_proxy: Avoid reading host log when using a virtual device Jarkko Sakkinen
2021-03-10 23:04 ` [PATCH v2 0/3] Fix bugs related to TPM2 event log Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210310221916.356716-4-stefanb@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).