aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/api.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/crypto/api.c b/crypto/api.c
index fd2545decb28..f500fb840be9 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -580,20 +580,17 @@ EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
580void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm) 580void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
581{ 581{
582 struct crypto_alg *alg; 582 struct crypto_alg *alg;
583 int size;
584 583
585 if (unlikely(!mem)) 584 if (unlikely(!mem))
586 return; 585 return;
587 586
588 alg = tfm->__crt_alg; 587 alg = tfm->__crt_alg;
589 size = ksize(mem);
590 588
591 if (!tfm->exit && alg->cra_exit) 589 if (!tfm->exit && alg->cra_exit)
592 alg->cra_exit(tfm); 590 alg->cra_exit(tfm);
593 crypto_exit_ops(tfm); 591 crypto_exit_ops(tfm);
594 crypto_mod_put(alg); 592 crypto_mod_put(alg);
595 memset(mem, 0, size); 593 kzfree(mem);
596 kfree(mem);
597} 594}
598EXPORT_SYMBOL_GPL(crypto_destroy_tfm); 595EXPORT_SYMBOL_GPL(crypto_destroy_tfm);
599 596