Commit 8d02490c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tpmdd-next-v5.13-rc2' of...

Merge tag 'tpmdd-next-v5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd

Pull tpm fixes from Jarkko Sakkinen:
 "Bug fixes that have came up after the first pull request"

* tag 'tpmdd-next-v5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
  tpm: fix error return code in tpm2_get_cc_attrs_tbl()
  tpm, tpm_tis: Reserve locality in tpm_tis_resume()
  tpm, tpm_tis: Extend locality handling to TPM2 in tpm_tis_gen_interrupt()
  trusted-keys: match tpm_get_ops on all return paths
  KEYS: trusted: Fix memory leak on object td
parents dbb5afad 1df83992
...@@ -656,6 +656,7 @@ int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip) ...@@ -656,6 +656,7 @@ int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
if (nr_commands != if (nr_commands !=
be32_to_cpup((__be32 *)&buf.data[TPM_HEADER_SIZE + 5])) { be32_to_cpup((__be32 *)&buf.data[TPM_HEADER_SIZE + 5])) {
rc = -EFAULT;
tpm_buf_destroy(&buf); tpm_buf_destroy(&buf);
goto out; goto out;
} }
......
...@@ -709,16 +709,14 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) ...@@ -709,16 +709,14 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
cap_t cap; cap_t cap;
int ret; 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); ret = request_locality(chip, 0);
if (ret < 0) if (ret < 0)
return ret; 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); release_locality(chip, 0);
...@@ -1127,12 +1125,20 @@ int tpm_tis_resume(struct device *dev) ...@@ -1127,12 +1125,20 @@ int tpm_tis_resume(struct device *dev)
if (ret) if (ret)
return ret; return ret;
/* TPM 1.2 requires self-test on resume. This function actually returns /*
* TPM 1.2 requires self-test on resume. This function actually returns
* an error code but for unknown reason it isn't handled. * an error code but for unknown reason it isn't handled.
*/ */
if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
ret = request_locality(chip, 0);
if (ret < 0)
return ret;
tpm1_do_selftest(chip); tpm1_do_selftest(chip);
release_locality(chip, 0);
}
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(tpm_tis_resume); EXPORT_SYMBOL_GPL(tpm_tis_resume);
......
...@@ -493,10 +493,12 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype, ...@@ -493,10 +493,12 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
ret = tpm_get_random(chip, td->nonceodd, TPM_NONCE_SIZE); ret = tpm_get_random(chip, td->nonceodd, TPM_NONCE_SIZE);
if (ret < 0) if (ret < 0)
return ret; goto out;
if (ret != TPM_NONCE_SIZE) if (ret != TPM_NONCE_SIZE) {
return -EIO; ret = -EIO;
goto out;
}
ordinal = htonl(TPM_ORD_SEAL); ordinal = htonl(TPM_ORD_SEAL);
datsize = htonl(datalen); datsize = htonl(datalen);
......
...@@ -336,9 +336,9 @@ int tpm2_seal_trusted(struct tpm_chip *chip, ...@@ -336,9 +336,9 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
rc = -EPERM; rc = -EPERM;
} }
if (blob_len < 0) if (blob_len < 0)
return blob_len; rc = blob_len;
else
payload->blob_len = blob_len; payload->blob_len = blob_len;
tpm_put_ops(chip); tpm_put_ops(chip);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment