Skip to content

Commit 3d9ae54

Browse files
jejbjarkkojs
authored andcommitted
tpm_tis: Fix check_locality for correct locality acquisition
The TPM TIS specification says the TPM signals the acquisition of locality when the TMP_ACCESS_REQUEST_USE bit goes to one *and* the TPM_ACCESS_REQUEST_USE bit goes to zero. Currently we only check the former not the latter, so check both. Adding the check on TPM_ACCESS_REQUEST_USE should fix the case where the locality is re-requested before the TPM has released it. In this case the locality may get released briefly before it is reacquired, which causes all sorts of problems. However, with the added check, TPM_ACCESS_REQUEST_USE should remain 1 until the second request for the locality is granted. Cc: [email protected] Fixes: 27084ef ("[PATCH] tpm: driver for next generation TPM chips") Signed-off-by: James Bottomley <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent f40ddce commit 3d9ae54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/char/tpm/tpm_tis_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ static bool check_locality(struct tpm_chip *chip, int l)
125125
if (rc < 0)
126126
return false;
127127

128-
if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) ==
128+
if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID
129+
| TPM_ACCESS_REQUEST_USE)) ==
129130
(TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) {
130131
priv->locality = l;
131132
return true;

0 commit comments

Comments
 (0)