Skip to content

Commit

Permalink
tpm, tpm_tis: Extend locality handling to TPM2 in tpm_tis_gen_interru…
Browse files Browse the repository at this point in the history
…pt()

The earlier fix (linked) only partially fixed the locality handling bug
in tpm_tis_gen_interrupt(), i.e. only for TPM 1.x.

Extend the locality handling to cover TPM2.

Cc: Hans de Goede <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/linux-integrity/[email protected]/
Fixes: a3fbfae ("tpm: take TPM chip power gating out of tpm_transmit()")
Reported-by: Lino Sanfilippo <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
Tested-by: Lino Sanfilippo <[email protected]>
  • Loading branch information
jarkkojs committed May 12, 2021
1 parent b3ad785 commit e630af7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/char/tpm/tpm_tis_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,16 +709,14 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
cap_t cap;
int ret;

/* TPM 2.0 */
if (chip->flags & TPM_CHIP_FLAG_TPM2)
return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc);

/* TPM 1.2 */
ret = request_locality(chip, 0);
if (ret < 0)
return ret;

ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0);
if (chip->flags & TPM_CHIP_FLAG_TPM2)
ret = tpm2_get_tpm_pt(chip, 0x100, &cap2, desc);
else
ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0);

release_locality(chip, 0);

Expand Down

0 comments on commit e630af7

Please sign in to comment.