summaryrefslogtreecommitdiff
path: root/crypto/api.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2018-05-09 22:00:19 +0300
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-05-09 22:00:19 +0300
commitcc1c8445eba5b78f5b719c47572473d7a7caa038 (patch)
tree3954bcaa641ee362bf06b7aa9197d30a90eb4ca3 /crypto/api.c
parentab460a2e72dabecfdabd45eb7e3ee2d73fc876d4 (diff)
parent75bc37fefc4471e718ba8e651aa74673d4e0a9eb (diff)
downloadlinux-cc1c8445eba5b78f5b719c47572473d7a7caa038.tar.xz
Merge tag 'v4.17-rc4' into rpmsg-next
Pick up fixes from rproc-v4.17-1 Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'crypto/api.c')
-rw-r--r--crypto/api.c11
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,
down_read(&crypto_alg_sem);
alg = __crypto_alg_lookup(name, type | test, mask | test);
- if (!alg && test)
- alg = __crypto_alg_lookup(name, type, mask) ?
- ERR_PTR(-ELIBBAD) : NULL;
+ if (!alg && test) {
+ alg = __crypto_alg_lookup(name, type, mask);
+ if (alg && !crypto_is_larval(alg)) {
+ /* Test failed */
+ crypto_mod_put(alg);
+ alg = ERR_PTR(-ELIBBAD);
+ }
+ }
up_read(&crypto_alg_sem);
return alg;