summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorAmir Mizinski <amirmizi6@gmail.com>2021-11-04 17:02:08 +0300
committerJoel Stanley <joel@jms.id.au>2022-01-14 06:48:50 +0300
commit70eb4261d08ff8530761e078faf211680f31cae1 (patch)
treedd7c5353e529058274f510e382af3bc539f757f2 /drivers/char
parent02ae180b180c77e2cd31ddf0c000346d2725e8fb (diff)
downloadlinux-70eb4261d08ff8530761e078faf211680f31cae1.tar.xz
tpm: tpm_tis: Rewrite "tpm_tis_req_canceled()"
tpm_tis_req_canceled() function is used to check if the caller requested to abort the current operation. It was found that in some cases tpm_tis_req_canceled() wrongly returned true. Since a cancel request sets the TPM_STS.commandReady field to TRUE, the tpm_tis_req_canceled() function should check only the TPM_STS.commandReady field value. The case for TPM_VID_WINBOND is wrong and was therefore removed. Also, the default comparison is wrong. Only cmdReady bit needs to be compared instead of the full lower status register byte. OpenBMC-Staging-Count: 1 Signed-off-by: Amir Mizinski <amirmizi6@gmail.com> Link: https://lore.kernel.org/r/20211104140211.6258-3-amirmizi6@gmail.com Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_tis_core.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index f6949d939682..2d11445e3eb4 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -662,13 +662,10 @@ static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status)
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
switch (priv->manufacturer_id) {
- case TPM_VID_WINBOND:
- return ((status == TPM_STS_VALID) ||
- (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY)));
case TPM_VID_STM:
return (status == (TPM_STS_VALID | TPM_STS_COMMAND_READY));
default:
- return (status == TPM_STS_COMMAND_READY);
+ return (status & TPM_STS_COMMAND_READY) == TPM_STS_COMMAND_READY;
}
}