diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2021-04-29 22:21:56 +0300 |
---|---|---|
committer | Jarkko Sakkinen <jarkko@kernel.org> | 2021-05-12 22:36:37 +0300 |
commit | b3ad7855b7ae3bed4242894d07bdb7f186652dbe (patch) | |
tree | 29702fbc09fa26150268f5abbb03d9fb5181a79c /security | |
parent | 83a775d5f9bfda95b1c295f95a3a041a40c7f321 (diff) | |
download | linux-b3ad7855b7ae3bed4242894d07bdb7f186652dbe.tar.xz |
trusted-keys: match tpm_get_ops on all return paths
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: f2219745250f ("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>
Diffstat (limited to 'security')
-rw-r--r-- | security/keys/trusted-keys/trusted_tpm2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c index 617fabd4d913..0165da386289 100644 --- a/security/keys/trusted-keys/trusted_tpm2.c +++ b/security/keys/trusted-keys/trusted_tpm2.c @@ -336,9 +336,9 @@ out: 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; |