summaryrefslogtreecommitdiff
path: root/crypto/cbc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-08 00:07:10 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-08 00:07:10 +0300
commit52ab2ec00518a164884c5670932557cd868b0193 (patch)
tree95e821540e945a1dfc1ab55dc3b5015eefb15d64 /crypto/cbc.c
parent7b24f6c082b3777749ccd19c9beb8643fa718480 (diff)
parente61efff4ae94f4509707a5e03f8edb6455f490e1 (diff)
downloadlinux-52ab2ec00518a164884c5670932557cd868b0193.tar.xz
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: - Disable the new crypto stats interface as it's still being changed - Fix potential uses-after-free in cbc/cfb/pcbc. * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: user - Disable statistics interface crypto: do not free algorithm before using
Diffstat (limited to 'crypto/cbc.c')
-rw-r--r--crypto/cbc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/cbc.c b/crypto/cbc.c
index b761b1f9c6ca..dd5f332fd566 100644
--- a/crypto/cbc.c
+++ b/crypto/cbc.c
@@ -140,9 +140,8 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb)
spawn = skcipher_instance_ctx(inst);
err = crypto_init_spawn(spawn, alg, skcipher_crypto_instance(inst),
CRYPTO_ALG_TYPE_MASK);
- crypto_mod_put(alg);
if (err)
- goto err_free_inst;
+ goto err_put_alg;
err = crypto_inst_setname(skcipher_crypto_instance(inst), "cbc", alg);
if (err)
@@ -174,12 +173,15 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb)
err = skcipher_register_instance(tmpl, inst);
if (err)
goto err_drop_spawn;
+ crypto_mod_put(alg);
out:
return err;
err_drop_spawn:
crypto_drop_spawn(spawn);
+err_put_alg:
+ crypto_mod_put(alg);
err_free_inst:
kfree(inst);
goto out;