Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[sfrench/cifs-2.6.git] / crypto / algapi.c
index 7c41e7405c41a4392791cc4a01a22cce52f983b0..56c62e2858d56a9eee11b9167fe8362a71a7c6c1 100644 (file)
@@ -149,6 +149,9 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg)
                if (q == alg)
                        goto err;
 
+               if (crypto_is_moribund(q))
+                       continue;
+
                if (crypto_is_larval(q)) {
                        if (!strcmp(alg->cra_driver_name, q->cra_driver_name))
                                goto err;
@@ -197,7 +200,7 @@ void crypto_alg_tested(const char *name, int err)
 
        down_write(&crypto_alg_sem);
        list_for_each_entry(q, &crypto_alg_list, cra_list) {
-               if (!crypto_is_larval(q))
+               if (crypto_is_moribund(q) || !crypto_is_larval(q))
                        continue;
 
                test = (struct crypto_larval *)q;
@@ -210,6 +213,7 @@ void crypto_alg_tested(const char *name, int err)
        goto unlock;
 
 found:
+       q->cra_flags |= CRYPTO_ALG_DEAD;
        alg = test->adult;
        if (err || list_empty(&alg->cra_list))
                goto complete;