aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorJiri Kosina2018-06-08 10:22:26 +0200
committerJiri Kosina2018-06-08 10:22:26 +0200
commit37acd687269f8cb8366598e292f96eb5605d3e3a (patch)
treee49cc91bef34755b9a279b60ed8d10ea01eec725 /crypto
parent79b83b05b07a40c67ac7196555d2b0293cdf26e7 (diff)
parent4b64487fa63a71bbed883b55268ea275da6f8a7a (diff)
Merge branch 'for-4.18/hid-steam' into for-linus
Valve Steam Controller support from Rodrigo Rivas Costa
Diffstat (limited to 'crypto')
-rw-r--r--crypto/api.c11
-rw-r--r--crypto/drbg.c2
2 files changed, 10 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;
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 4faa2781c964..466a112a4446 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1134,8 +1134,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
if (!drbg)
return;
kzfree(drbg->Vbuf);
+ drbg->Vbuf = NULL;
drbg->V = NULL;
kzfree(drbg->Cbuf);
+ drbg->Cbuf = NULL;
drbg->C = NULL;
kzfree(drbg->scratchpadbuf);
drbg->scratchpadbuf = NULL;