From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Cc: cjengel@us.ibm.com, joel@jms.id.au
Subject: [PATCH u-boot v2019.04-aspeed-openbmc v2 4/9] tis: fix tpm_tis_remove()
Date: Fri, 13 May 2022 12:07:10 -0500 [thread overview]
Message-ID: <20220513170715.43475-5-eajames@linux.ibm.com> (raw)
In-Reply-To: <20220513170715.43475-1-eajames@linux.ibm.com>
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
tpm_tis_remove() leads to calling tpm_tis_ready() with the IO region
unmapped and chip->locality == -1 (locality released). This leads to a
crash in mmio_write_bytes().
The patch implements these changes:
tpm_tis_remove(): Unmap the IO region after calling tpm_tis_cleanup().
tpm_tis_cleanup(): Request locality before IO output and releasing
locality.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
drivers/tpm/tpm2_tis_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/tpm/tpm2_tis_core.c b/drivers/tpm/tpm2_tis_core.c
index ec8c730fe9..51392c4584 100644
--- a/drivers/tpm/tpm2_tis_core.c
+++ b/drivers/tpm/tpm2_tis_core.c
@@ -378,8 +378,14 @@ out:
int tpm_tis_cleanup(struct udevice *dev)
{
struct tpm_chip *chip = dev_get_priv(dev);
+ int ret;
+
+ ret = tpm_tis_request_locality(dev, 0);
+ if (ret)
+ return ret;
tpm_tis_ready(dev);
+
tpm_tis_release_locality(dev, chip->locality);
return 0;
--
2.27.0
next prev parent reply other threads:[~2022-05-13 17:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 17:07 [PATCH u-boot v2019.04-aspeed-openbmc v2 0/9] ast2600: Add I2C TPMv2 driver Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 1/9] tpm: Add more TPM2 definitions Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 2/9] tpm: add #ifndef to fix redeclaration build errors Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 3/9] tpm2: Introduce TIS tpm core Eddie James
2022-05-13 17:07 ` Eddie James [this message]
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 5/9] tpm: core: Set timeouts before requesting locality Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 6/9] i2c: ast_i2c: Remove SCL direct drive mode Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 7/9] tpm: add support for TPMv2.x I2C chips Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 8/9] arm: dts: ast2600-rainier: Add NPCT75X TPM Eddie James
2022-05-13 17:07 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 9/9] board: ast2600-ibm: Add AST2600 BMC based POWER10+ servers Eddie James
2022-05-20 6:30 ` Joel Stanley
2022-05-24 16:42 ` Eddie James
2022-05-20 6:31 ` [PATCH u-boot v2019.04-aspeed-openbmc v2 0/9] ast2600: Add I2C TPMv2 driver Joel Stanley
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=20220513170715.43475-5-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=cjengel@us.ibm.com \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.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.