summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto/algapi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 2d0a1c64ce39..d2627a3d4ed8 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -525,12 +525,12 @@ int crypto_register_instance(struct crypto_template *tmpl,
if (err)
return err;
- if (unlikely(!crypto_mod_get(&inst->alg)))
- return -EAGAIN;
-
inst->alg.cra_module = tmpl->module;
inst->alg.cra_flags |= CRYPTO_ALG_INSTANCE;
+ if (unlikely(!crypto_mod_get(&inst->alg)))
+ return -EAGAIN;
+
down_write(&crypto_alg_sem);
larval = __crypto_register_alg(&inst->alg);