Commit:     38cb2419f544ad413c7f7aa8c17fd7377610cdd8
Parent:     f347c4facfee3d11eb9cd1c070ab471a8fb7401e
Author:     Herbert Xu <[EMAIL PROTECTED]>
AuthorDate: Sat Nov 17 22:09:38 2007 +0800
Committer:  Herbert Xu <[EMAIL PROTECTED]>
CommitDate: Fri Nov 23 19:32:09 2007 +0800

    [CRYPTO] api: Fix potential race in crypto_remove_spawn
    As it is crypto_remove_spawn may try to unregister an instance which is
    yet to be registered.  This patch fixes this by checking whether the
    instance has been registered before attempting to remove it.
    It also removes a bogus cra_destroy check in crypto_register_instance as
    1) it's outside the mutex;
    2) we have a check in __crypto_register_alg already.
    Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
 crypto/algapi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/algapi.c b/crypto/algapi.c
index 8ff8c26..8383282 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -95,6 +95,9 @@ static void crypto_remove_spawn(struct crypto_spawn *spawn,
        inst->alg.cra_flags |= CRYPTO_ALG_DEAD;
+       if (hlist_unhashed(&inst->list))
+               return;
        if (!tmpl || !crypto_tmpl_get(tmpl))
@@ -335,9 +338,6 @@ int crypto_register_instance(struct crypto_template *tmpl,
        int err = -EINVAL;
-       if (inst->alg.cra_destroy)
-               goto err;
        err = crypto_check_alg(&inst->alg);
        if (err)
                goto err;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to