diff options
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/api.c b/crypto/api.c index 1d5290c67108..0ee632bba064 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
@@ -204,9 +204,14 @@ static struct crypto_alg *crypto_alg_lookup(const char *name, u32 type, | |||
204 | 204 | ||
205 | down_read(&crypto_alg_sem); | 205 | down_read(&crypto_alg_sem); |
206 | alg = __crypto_alg_lookup(name, type | test, mask | test); | 206 | alg = __crypto_alg_lookup(name, type | test, mask | test); |
207 | if (!alg && test) | 207 | if (!alg && test) { |
208 | alg = __crypto_alg_lookup(name, type, mask) ? | 208 | alg = __crypto_alg_lookup(name, type, mask); |
209 | ERR_PTR(-ELIBBAD) : NULL; | 209 | if (alg && !crypto_is_larval(alg)) { |
210 | /* Test failed */ | ||
211 | crypto_mod_put(alg); | ||
212 | alg = ERR_PTR(-ELIBBAD); | ||
213 | } | ||
214 | } | ||
210 | up_read(&crypto_alg_sem); | 215 | up_read(&crypto_alg_sem); |
211 | 216 | ||
212 | return alg; | 217 | return alg; |