From 77219e5f1c9079c9ab7c17ed11abb1f4f4168fd3 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 13 Sep 2008 18:19:03 -0700 Subject: [PATCH] --- yaml --- r: 120594 b: refs/heads/master c: 4a7794860ba2b56693b1d89fd485fd08cdc763e3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/crypto/api.c | 13 ++++++------- trunk/include/crypto/algapi.h | 1 - trunk/include/linux/crypto.h | 2 ++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 638d7df62b15..200bcb279380 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2566578a6feb9d9e39da41326afe8ed6022db3c5 +refs/heads/master: 4a7794860ba2b56693b1d89fd485fd08cdc763e3 diff --git a/trunk/crypto/api.c b/trunk/crypto/api.c index 0444d242e985..cbaaf346ad13 100644 --- a/trunk/crypto/api.c +++ b/trunk/crypto/api.c @@ -300,8 +300,8 @@ static void crypto_exit_ops(struct crypto_tfm *tfm) const struct crypto_type *type = tfm->__crt_alg->cra_type; if (type) { - if (type->exit) - type->exit(tfm); + if (tfm->exit) + tfm->exit(tfm); return; } @@ -379,17 +379,16 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, if (err) goto out_free_tfm; - if (alg->cra_init && (err = alg->cra_init(tfm))) { - if (err == -EAGAIN) - crypto_shoot_alg(alg); + if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) goto cra_init_failed; - } goto out; cra_init_failed: crypto_exit_ops(tfm); out_free_tfm: + if (err == -EAGAIN) + crypto_shoot_alg(alg); kfree(tfm); out_err: tfm = ERR_PTR(err); @@ -469,7 +468,7 @@ void crypto_free_tfm(struct crypto_tfm *tfm) alg = tfm->__crt_alg; size = sizeof(*tfm) + alg->cra_ctxsize; - if (alg->cra_exit) + if (!tfm->exit && alg->cra_exit) alg->cra_exit(tfm); crypto_exit_ops(tfm); crypto_mod_put(alg); diff --git a/trunk/include/crypto/algapi.h b/trunk/include/crypto/algapi.h index 60d06e784be3..5fb6d8618d4d 100644 --- a/trunk/include/crypto/algapi.h +++ b/trunk/include/crypto/algapi.h @@ -23,7 +23,6 @@ struct seq_file; struct crypto_type { unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); - void (*exit)(struct crypto_tfm *tfm); void (*show)(struct seq_file *m, struct crypto_alg *alg); }; diff --git a/trunk/include/linux/crypto.h b/trunk/include/linux/crypto.h index 3d2317e4af2e..ea52cd944fd9 100644 --- a/trunk/include/linux/crypto.h +++ b/trunk/include/linux/crypto.h @@ -480,6 +480,8 @@ struct crypto_tfm { struct compress_tfm compress; struct rng_tfm rng; } crt_u; + + void (*exit)(struct crypto_tfm *tfm); struct crypto_alg *__crt_alg;