Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1558805

[PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown

From Andrey Pronin <apronin@chromium.org>
Newsgroups linux.kernel
Subject [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown
Date 2017-01-14 01:20 +0100
Message-ID <sZkeB-7yO-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Resetting TPM while processing a command may lead to issues
on the next boot. Ensure that we don't have any ongoing
commands, and that no further commands can be sent to the chip
by unregistering the device in the shutdown handler.
tpm_chip_unregister() waits for the completion of an ongoing
command, if any, and then clears out chip->ops and unregisters
sysfs entities.

Signed-off-by: Andrey Pronin <apronin@chromium.org>
---
 drivers/char/tpm/tpm_i2c_infineon.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index 62ee44e57ddc..0c829fe26561 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -689,14 +689,18 @@ static int tpm_tis_i2c_probe(struct i2c_client *client,
 	return rc;
 }
 
-static int tpm_tis_i2c_remove(struct i2c_client *client)
+static void tpm_tis_i2c_shutdown(struct i2c_client *client)
 {
 	struct tpm_chip *chip = tpm_dev.chip;
 
 	tpm_chip_unregister(chip);
 	release_locality(chip, tpm_dev.locality, 1);
 	tpm_dev.client = NULL;
+}
 
+static int tpm_tis_i2c_remove(struct i2c_client *client)
+{
+	tpm_tis_i2c_shutdown(client);
 	return 0;
 }
 
@@ -704,6 +708,7 @@ static struct i2c_driver tpm_tis_i2c_driver = {
 	.id_table = tpm_tis_i2c_table,
 	.probe = tpm_tis_i2c_probe,
 	.remove = tpm_tis_i2c_remove,
+	.shutdown = tpm_tis_i2c_shutdown,
 	.driver = {
 		   .name = "tpm_i2c_infineon",
 		   .pm = &tpm_tis_i2c_ops,
-- 
2.11.0.483.g087da7b7c-goog

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-14 01:20 +0100
  Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-14 01:40 +0100
    Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Andrey Pronin <apronin@chromium.org> - 2017-01-14 01:50 +0100
      Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-01-16 10:40 +0100
      Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on  shutdown Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-01-16 17:20 +0100

csiph-web