diff options
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crypto/api.c b/crypto/api.c index 0444d242e985..cbaaf346ad13 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -300,8 +300,8 @@ static void crypto_exit_ops(struct crypto_tfm *tfm) | |||
300 | const struct crypto_type *type = tfm->__crt_alg->cra_type; | 300 | const struct crypto_type *type = tfm->__crt_alg->cra_type; |
301 | 301 | ||
302 | if (type) { | 302 | if (type) { |
303 | if (type->exit) | 303 | if (tfm->exit) |
304 | type->exit(tfm); | 304 | tfm->exit(tfm); |
305 | return; | 305 | return; |
306 | } | 306 | } |
307 | 307 | ||
@@ -379,17 +379,16 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, | |||
379 | if (err) | 379 | if (err) |
380 | goto out_free_tfm; | 380 | goto out_free_tfm; |
381 | 381 | ||
382 | if (alg->cra_init && (err = alg->cra_init(tfm))) { | 382 | if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) |
383 | if (err == -EAGAIN) | ||
384 | crypto_shoot_alg(alg); | ||
385 | goto cra_init_failed; | 383 | goto cra_init_failed; |
386 | } | ||
387 | 384 | ||
388 | goto out; | 385 | goto out; |
389 | 386 | ||
390 | cra_init_failed: | 387 | cra_init_failed: |
391 | crypto_exit_ops(tfm); | 388 | crypto_exit_ops(tfm); |
392 | out_free_tfm: | 389 | out_free_tfm: |
390 | if (err == -EAGAIN) | ||
391 | crypto_shoot_alg(alg); | ||
393 | kfree(tfm); | 392 | kfree(tfm); |
394 | out_err: | 393 | out_err: |
395 | tfm = ERR_PTR(err); | 394 | tfm = ERR_PTR(err); |
@@ -469,7 +468,7 @@ void crypto_free_tfm(struct crypto_tfm *tfm) | |||
469 | alg = tfm->__crt_alg; | 468 | alg = tfm->__crt_alg; |
470 | size = sizeof(*tfm) + alg->cra_ctxsize; | 469 | size = sizeof(*tfm) + alg->cra_ctxsize; |
471 | 470 | ||
472 | if (alg->cra_exit) | 471 | if (!tfm->exit && alg->cra_exit) |
473 | alg->cra_exit(tfm); | 472 | alg->cra_exit(tfm); |
474 | crypto_exit_ops(tfm); | 473 | crypto_exit_ops(tfm); |
475 | crypto_mod_put(alg); | 474 | crypto_mod_put(alg); |