aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/crypto')
-rw-r--r--arch/x86/crypto/aesni-intel_glue.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index e1e60c7d581..e0135526345 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -873,21 +873,19 @@ rfc4106_set_hash_subkey(u8 *hash_subkey, const u8 *key, unsigned int key_len)
crypto_ablkcipher_clear_flags(ctr_tfm, ~0);
ret = crypto_ablkcipher_setkey(ctr_tfm, key, key_len);
- if (ret) {
- crypto_free_ablkcipher(ctr_tfm);
- return ret;
- }
+ if (ret)
+ goto out;
req = ablkcipher_request_alloc(ctr_tfm, GFP_KERNEL);
if (!req) {
- crypto_free_ablkcipher(ctr_tfm);
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_free_ablkcipher;
}
req_data = kmalloc(sizeof(*req_data), GFP_KERNEL);
if (!req_data) {
- crypto_free_ablkcipher(ctr_tfm);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto out_free_request;
}
memset(req_data->iv, 0, sizeof(req_data->iv));
@@ -913,9 +911,12 @@ rfc4106_set_hash_subkey(u8 *hash_subkey, const u8 *key, unsigned int key_len)
if (!ret)
ret = req_data->result.err;
}
+out_free_request:
ablkcipher_request_free(req);
kfree(req_data);
+out_free_ablkcipher:
crypto_free_ablkcipher(ctr_tfm);
+out:
return ret;
}