linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm_tis: Add missing start/stop_tpm_chip calls
@ 2021-01-23  1:42 Lukasz Majczak
  2021-01-25 17:12 ` Jarkko Sakkinen
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Lukasz Majczak @ 2021-01-23  1:42 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe
  Cc: linux-integrity, linux-kernel, Radoslaw Biernacki, Marcin Wojtas,
	Alex Levin

There is a missing call to start_tpm_chip before the call to
the tpm_get_timeouts() and tpm_tis_probe_irq_single(). As the current
approach maight work for tpm2, it fails for tpm1.x - in that case
call to tpm_get_timeouts() or tpm_tis_probe_irq_single() tries to
transmit TPM commands on a disabled chip what what doesn't succeed
and in turn causes tpm_tis_core_init() to fail.
Tested on Samsung Chromebook Pro (Caroline).

Signed-off-by: Lukasz Majczak <lma@semihalf.com>
---
 drivers/char/tpm/tpm_tis_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 92c51c6cfd1b..ff0e5fe46a9d 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -1063,12 +1063,16 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	init_waitqueue_head(&priv->read_queue);
 	init_waitqueue_head(&priv->int_queue);
 	if (irq != -1) {
+		rc = tpm_chip_start(chip);
+		if (rc)
+			goto out_err;
 		/* Before doing irq testing issue a command to the TPM in polling mode
 		 * to make sure it works. May as well use that command to set the
 		 * proper timeouts for the driver.
 		 */
 		if (tpm_get_timeouts(chip)) {
 			dev_err(dev, "Could not get TPM timeouts and durations\n");
+			tpm_chip_stop(chip);
 			rc = -ENODEV;
 			goto out_err;
 		}
@@ -1085,6 +1089,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
 		}
+		tpm_chip_stop(chip);
 	}
 
 	rc = tpm_chip_register(chip);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2021-02-03 23:24 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23  1:42 [PATCH] tpm_tis: Add missing start/stop_tpm_chip calls Lukasz Majczak
2021-01-25 17:12 ` Jarkko Sakkinen
2021-01-25 17:18 ` Guenter Roeck
2021-01-26 15:46   ` Łukasz Majczak
2021-01-26 16:46     ` James Bottomley
2021-01-26 18:55       ` Tj (Elloe Linux)
2021-01-28  5:58       ` Jarkko Sakkinen
2021-01-29 22:59     ` Jarkko Sakkinen
2021-01-29 23:00       ` Jarkko Sakkinen
2021-01-30 23:49       ` Guenter Roeck
2021-01-31  0:41         ` James Bottomley
2021-01-31  3:36           ` Guenter Roeck
2021-01-31  4:18             ` James Bottomley
2021-02-02 16:17           ` Jarkko Sakkinen
2021-02-02 15:33         ` Jarkko Sakkinen
2021-01-29 22:49   ` Jarkko Sakkinen
2021-01-29 23:32     ` Guenter Roeck
2021-01-28 13:07 ` [PATCH v2] tpm_tis: Add missing tpm_request/relinquish_locality calls Lukasz Majczak
2021-01-28 17:37   ` Guenter Roeck
2021-01-30 20:40   ` Jarkko Sakkinen
2021-01-30 20:47     ` Jarkko Sakkinen
     [not found]     ` <ghwnvtwifq.fsf@gouders.net>
2021-02-02 16:29       ` Jarkko Sakkinen
2021-02-02 15:51   ` [PATCH v3] " Lukasz Majczak
2021-02-02 16:29     ` Guenter Roeck
2021-02-02 22:35       ` Jarkko Sakkinen
2021-02-02 18:47     ` Dirk Gouders
2021-02-03 11:46       ` Dirk Gouders
2021-02-03 13:43         ` Lukasz Majczak
2021-02-03 23:24           ` Jarkko Sakkinen
2021-02-02 19:57     ` [PATCH v4] " Lukasz Majczak
2021-02-02 21:49       ` Jarkko Sakkinen
2021-02-02 21:49     ` [PATCH v3] " Jarkko Sakkinen
2021-02-03  0:05       ` Jarkko Sakkinen
2021-02-03  0:07         ` Jarkko Sakkinen

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).