On Thu, Oct 01, 2020 at 11:09:21AM -0700, James Bottomley wrote: > 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 Put a reference to the section. I'm *guessing* that the spec is https://trustedcomputinggroup.org/resource/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis Please have this and also location in this spec. > 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. The description is really good and understandable otherwise. For me it is not obvious at all, why this is missing a fixes tag? > Signed-off-by: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> > > --- > > v2: added this patch Use the cover letter for the changelog. I'm afraid that I might miss these otherwise. > --- > drivers/char/tpm/tpm_tis_core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c > index 92c51c6cfd1b..f3ecde8df47d 100644 > --- a/drivers/char/tpm/tpm_tis_core.c > +++ b/drivers/char/tpm/tpm_tis_core.c > @@ -125,7 +125,8 @@ static bool check_locality(struct tpm_chip *chip, int l) > if (rc < 0) > return false; > > - if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == > + if ((access & (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID > + | TPM_ACCESS_REQUEST_USE)) == > (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) { > priv->locality = l; > return true; > -- > 2.28.0 > /Jarkko