diff options
-rw-r--r-- | fs/cifs/cifsencrypt.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 8347c90cf483..5eb04129f938 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -808,7 +808,11 @@ calc_seckey(struct cifs_ses *ses) | |||
808 | struct crypto_skcipher *tfm_arc4; | 808 | struct crypto_skcipher *tfm_arc4; |
809 | struct scatterlist sgin, sgout; | 809 | struct scatterlist sgin, sgout; |
810 | struct skcipher_request *req; | 810 | struct skcipher_request *req; |
811 | unsigned char sec_key[CIFS_SESS_KEY_SIZE]; /* a nonce */ | 811 | unsigned char *sec_key; |
812 | |||
813 | sec_key = kmalloc(CIFS_SESS_KEY_SIZE, GFP_KERNEL); | ||
814 | if (sec_key == NULL) | ||
815 | return -ENOMEM; | ||
812 | 816 | ||
813 | get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE); | 817 | get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE); |
814 | 818 | ||
@@ -816,7 +820,7 @@ calc_seckey(struct cifs_ses *ses) | |||
816 | if (IS_ERR(tfm_arc4)) { | 820 | if (IS_ERR(tfm_arc4)) { |
817 | rc = PTR_ERR(tfm_arc4); | 821 | rc = PTR_ERR(tfm_arc4); |
818 | cifs_dbg(VFS, "could not allocate crypto API arc4\n"); | 822 | cifs_dbg(VFS, "could not allocate crypto API arc4\n"); |
819 | return rc; | 823 | goto out; |
820 | } | 824 | } |
821 | 825 | ||
822 | rc = crypto_skcipher_setkey(tfm_arc4, ses->auth_key.response, | 826 | rc = crypto_skcipher_setkey(tfm_arc4, ses->auth_key.response, |
@@ -854,7 +858,8 @@ calc_seckey(struct cifs_ses *ses) | |||
854 | 858 | ||
855 | out_free_cipher: | 859 | out_free_cipher: |
856 | crypto_free_skcipher(tfm_arc4); | 860 | crypto_free_skcipher(tfm_arc4); |
857 | 861 | out: | |
862 | kfree(sec_key); | ||
858 | return rc; | 863 | return rc; |
859 | } | 864 | } |
860 | 865 | ||