All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Peter Huewe <peterhuewe@gmx.de>
Cc: groeck@chromium.org, Vadim Sukhomlinov <sukhomlinov@google.com>,
	apronin@chromium.org, mka@chromium.org, swboyd@chromium.org,
	Douglas Anderson <dianders@chromium.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org, Jason Gunthorpe <jgg@ziepe.ca>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-integrity@vger.kernel.org
Subject: [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations
Date: Mon, 10 Jun 2019 15:01:18 -0700	[thread overview]
Message-ID: <20190610220118.5530-1-dianders@chromium.org> (raw)

From: Vadim Sukhomlinov <sukhomlinov@google.com>

TPM 2.0 Shutdown involve sending TPM2_Shutdown to TPM chip and disabling
future TPM operations. TPM 1.2 behavior was different, future TPM
operations weren't disabled, causing rare issues. This patch ensures
that future TPM operations are disabled.

Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
[dianders: resolved merge conflicts with mainline]
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/char/tpm/tpm-chip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 8804c9e916fd..f566fa8bf704 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -294,15 +294,15 @@ static int tpm_class_shutdown(struct device *dev)
 {
 	struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev);
 
+	down_write(&chip->ops_sem);
 	if (chip->flags & TPM_CHIP_FLAG_TPM2) {
-		down_write(&chip->ops_sem);
 		if (!tpm_chip_start(chip)) {
 			tpm2_shutdown(chip, TPM2_SU_CLEAR);
 			tpm_chip_stop(chip);
 		}
-		chip->ops = NULL;
-		up_write(&chip->ops_sem);
 	}
+	chip->ops = NULL;
+	up_write(&chip->ops_sem);
 
 	return 0;
 }
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


             reply	other threads:[~2019-06-10 22:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 22:01 Douglas Anderson [this message]
2019-06-12 19:16 ` [PATCH] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Jarkko Sakkinen
2019-06-13 13:58   ` Jarkko Sakkinen
2019-06-13 15:20     ` Doug Anderson
2019-06-14 15:15       ` Jarkko Sakkinen
2019-07-11 16:29 Douglas Anderson
2019-07-11 16:39 ` Jason Gunthorpe
2019-07-11 16:41   ` Doug Anderson
2019-07-11 17:04   ` Greg KH
2019-07-11 17:17     ` Jason Gunthorpe
2019-07-11 17:26       ` Greg KH
2019-07-11 17:28         ` Doug Anderson
2019-07-12 11:50           ` Greg KH
2019-07-12 15:00             ` Doug Anderson
2019-07-12 15:27               ` Greg KH
2019-08-05 21:05                 ` Jarkko Sakkinen
2019-07-12 15:47               ` Jarkko Sakkinen
2019-07-12 15:21             ` Jarkko Sakkinen
2019-07-11 18:35   ` Jarkko Sakkinen
2019-07-11 19:43     ` Jarkko Sakkinen
2019-07-11 19:46       ` Jason Gunthorpe
2019-07-12  3:31         ` Jarkko Sakkinen
2019-07-12  3:35           ` Jarkko Sakkinen
2019-07-12 11:58             ` Jason Gunthorpe
2019-07-11 19:55       ` Doug Anderson
2019-07-11 18:34 ` 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=20190610220118.5530-1-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=apronin@chromium.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=peterhuewe@gmx.de \
    --cc=sukhomlinov@google.com \
    --cc=swboyd@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.