Skip to contentSkip to conversation

tpm: tis_i2c: Fix sanity check interrupt enable mask

PATCH In review Eddie James 3 participants 5 messages Aug 17, 2022 – Nov 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: tis_i2c: Fix sanity check interrupt enable mask

The sanity check mask for TPM_INT_ENABLE register was off by 8 bits, resulting in failure to probe if the TPM_INT_ENABLE register was a valid value.

Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")
---
 drivers/char/tpm/tpm_tis_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_i2c.c +1 -1
index 0692510dfcab..635a69dfcbbd 100644
@@ -49,7 +49,7 @@
 
 /* Masks with bits that must be read zero */
 #define TPM_ACCESS_READ_ZERO 0x48
-#define TPM_INT_ENABLE_ZERO 0x7FFFFF6
+#define TPM_INT_ENABLE_ZERO 0x7FFFFF60
 #define TPM_STS_READ_ZERO 0x23
 #define TPM_INTF_CAPABILITY_ZERO 0x0FFFF000
 #define TPM_I2C_INTERFACE_CAPABILITY_ZERO 0x80000000
Signature · 1 line
2.31.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Eddie James

The sanity check mask for TPM_INT_ENABLE register was off by 8 bits, resulting in failure to probe if the TPM_INT_ENABLE register was a valid value.

Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")
---
 drivers/char/tpm/tpm_tis_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_i2c.c +1 -1
index 0692510dfcab..635a69dfcbbd 100644
@@ -49,7 +49,7 @@
 
 /* Masks with bits that must be read zero */
 #define TPM_ACCESS_READ_ZERO 0x48
-#define TPM_INT_ENABLE_ZERO 0x7FFFFF6
+#define TPM_INT_ENABLE_ZERO 0x7FFFFF60
 #define TPM_STS_READ_ZERO 0x23
 #define TPM_INTF_CAPABILITY_ZERO 0x0FFFF000
 #define TPM_I2C_INTERFACE_CAPABILITY_ZERO 0x80000000
Signature · 1 line
2.31.1

Thank you.

BR, Jarkko

maintainer
#2 lore raw
Quoted 30 lines · Jarkko Sakkinen
Quoted 26 lines · Eddie James

The sanity check mask for TPM_INT_ENABLE register was off by 8 bits, resulting in failure to probe if the TPM_INT_ENABLE register was a valid value.

Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")
---
 drivers/char/tpm/tpm_tis_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_i2c.c +1 -1
index 0692510dfcab..635a69dfcbbd 100644
@@ -49,7 +49,7 @@
 
 /* Masks with bits that must be read zero */
 #define TPM_ACCESS_READ_ZERO 0x48
-#define TPM_INT_ENABLE_ZERO 0x7FFFFF6
+#define TPM_INT_ENABLE_ZERO 0x7FFFFF60
 #define TPM_STS_READ_ZERO 0x23
 #define TPM_INTF_CAPABILITY_ZERO 0x0FFFF000
 #define TPM_I2C_INTERFACE_CAPABILITY_ZERO 0x80000000
Signature · 1 line
2.31.1
Quoted 1 line

Thank you.

I used "6.3 Handling of Multi-Byte Registers" I2C specification to check this. I do not posses I2C chip.

https://trustedcomputinggroup.org/wp-content/uploads/TCG-TPM-I2C-Interface-Specification-v1.00.pdf

BR, Jarkko

Tested-by on v1 1/1
#3 lore raw
In reply to Eddie James
Quoted 7 lines · Eddie James

The sanity check mask for TPM_INT_ENABLE register was off by 8 bits, resulting in failure to probe if the TPM_INT_ENABLE register was a valid value.

Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")
Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")

Jarkko, do you plan on sending this as a fix?

Quoted 20 lines
---
 drivers/char/tpm/tpm_tis_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_i2c.c +1 -2
index 0692510dfcab..635a69dfcbbd 100644
@@ -49,7 +49,7 @@
 
 /* Masks with bits that must be read zero */
 #define TPM_ACCESS_READ_ZERO 0x48
-#define TPM_INT_ENABLE_ZERO 0x7FFFFF6
+#define TPM_INT_ENABLE_ZERO 0x7FFFFF60
 #define TPM_STS_READ_ZERO 0x23
 #define TPM_INTF_CAPABILITY_ZERO 0x0FFFF000
 #define TPM_I2C_INTERFACE_CAPABILITY_ZERO 0x80000000
--

2.31.1

maintainer
#4 lore raw
Quoted 6 lines · Joel Stanley
Quoted 5 lines · Eddie James

The sanity check mask for TPM_INT_ENABLE register was off by 8 bits, resulting in failure to probe if the TPM_INT_ENABLE register was a valid value.

Quoted 7 lines
Quoted 2 lines
Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")
Fixes bbc23a07b072 ("tpm: Add tpm_tis_i2c backend for tpm_tis_core")

Jarkko, do you plan on sending this as a fix?

Thanks for reminding! I picked it.

BR, Jarkko