Skip to content

Commit

Permalink
trusted-keys: match tpm_get_ops on all return paths
Browse files Browse the repository at this point in the history
The `tpm_get_ops` call at the beginning of the function is not paired
with a `tpm_put_ops` on this return path.

Cc: stable@vger.kernel.org
Fixes: f221974 ("security: keys: trusted: use ASN.1 TPM2 key format for the blobs")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
  • Loading branch information
Ben Boeckel authored and Jarkko Sakkinen committed May 12, 2021
1 parent 83a775d commit b3ad785
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/keys/trusted-keys/trusted_tpm2.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
rc = -EPERM;
}
if (blob_len < 0)
return blob_len;

payload->blob_len = blob_len;
rc = blob_len;
else
payload->blob_len = blob_len;

tpm_put_ops(chip);
return rc;
Expand Down

0 comments on commit b3ad785

Please sign in to comment.