diff options
Diffstat (limited to 'arch/x86/crypto/aesni-intel_glue.c')
-rw-r--r-- | arch/x86/crypto/aesni-intel_glue.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index e1e60c7d5813..e0e6340c8dad 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
@@ -873,22 +873,18 @@ rfc4106_set_hash_subkey(u8 *hash_subkey, const u8 *key, unsigned int key_len) | |||
873 | crypto_ablkcipher_clear_flags(ctr_tfm, ~0); | 873 | crypto_ablkcipher_clear_flags(ctr_tfm, ~0); |
874 | 874 | ||
875 | ret = crypto_ablkcipher_setkey(ctr_tfm, key, key_len); | 875 | ret = crypto_ablkcipher_setkey(ctr_tfm, key, key_len); |
876 | if (ret) { | 876 | if (ret) |
877 | crypto_free_ablkcipher(ctr_tfm); | 877 | goto out_free_ablkcipher; |
878 | return ret; | ||
879 | } | ||
880 | 878 | ||
879 | ret = -ENOMEM; | ||
881 | req = ablkcipher_request_alloc(ctr_tfm, GFP_KERNEL); | 880 | req = ablkcipher_request_alloc(ctr_tfm, GFP_KERNEL); |
882 | if (!req) { | 881 | if (!req) |
883 | crypto_free_ablkcipher(ctr_tfm); | 882 | goto out_free_ablkcipher; |
884 | return -EINVAL; | ||
885 | } | ||
886 | 883 | ||
887 | req_data = kmalloc(sizeof(*req_data), GFP_KERNEL); | 884 | req_data = kmalloc(sizeof(*req_data), GFP_KERNEL); |
888 | if (!req_data) { | 885 | if (!req_data) |
889 | crypto_free_ablkcipher(ctr_tfm); | 886 | goto out_free_request; |
890 | return -ENOMEM; | 887 | |
891 | } | ||
892 | memset(req_data->iv, 0, sizeof(req_data->iv)); | 888 | memset(req_data->iv, 0, sizeof(req_data->iv)); |
893 | 889 | ||
894 | /* Clear the data in the hash sub key container to zero.*/ | 890 | /* Clear the data in the hash sub key container to zero.*/ |
@@ -913,8 +909,10 @@ rfc4106_set_hash_subkey(u8 *hash_subkey, const u8 *key, unsigned int key_len) | |||
913 | if (!ret) | 909 | if (!ret) |
914 | ret = req_data->result.err; | 910 | ret = req_data->result.err; |
915 | } | 911 | } |
916 | ablkcipher_request_free(req); | ||
917 | kfree(req_data); | 912 | kfree(req_data); |
913 | out_free_request: | ||
914 | ablkcipher_request_free(req); | ||
915 | out_free_ablkcipher: | ||
918 | crypto_free_ablkcipher(ctr_tfm); | 916 | crypto_free_ablkcipher(ctr_tfm); |
919 | return ret; | 917 | return ret; |
920 | } | 918 | } |