]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - crypto/api.c
crypto: api - Fix race condition in crypto_spawn_alg
[mirror_ubuntu-bionic-kernel.git] / crypto / api.c
index 2a2479d168aacbe3e31799a2c713614b71e6805b..6832b599ec4c70a8ebfcbcac9245574eca07b346 100644 (file)
@@ -216,7 +216,7 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
        mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD);
 
        alg = crypto_alg_lookup(name, type, mask);
-       if (!alg) {
+       if (!alg && !(mask & CRYPTO_NOLOAD)) {
                request_module("crypto-%s", name);
 
                if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
@@ -340,13 +340,12 @@ static unsigned int crypto_ctxsize(struct crypto_alg *alg, u32 type, u32 mask)
        return len;
 }
 
-void crypto_shoot_alg(struct crypto_alg *alg)
+static void crypto_shoot_alg(struct crypto_alg *alg)
 {
        down_write(&crypto_alg_sem);
        alg->cra_flags |= CRYPTO_ALG_DYING;
        up_write(&crypto_alg_sem);
 }
-EXPORT_SYMBOL_GPL(crypto_shoot_alg);
 
 struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type,
                                      u32 mask)