diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-28 20:02:44 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-28 20:02:44 +0300 |
commit | 6e041ffcc2d0bf8792937e89480b2172a9dd2823 (patch) | |
tree | 60bc2ee16c276c10dcb28592a1bc58daf5c9655f /crypto/api.c | |
parent | cac264288abe0f54b91e51d97c949b706c9435c7 (diff) | |
parent | eea0d3ea7546961f69f55b26714ac8fd71c7c020 (diff) | |
download | linux-6e041ffcc2d0bf8792937e89480b2172a9dd2823.tar.xz |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu:
- crypto API regression that may cause sporadic alloc failures
- double-free bug in drbg
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: drbg - set freed buffers to NULL
crypto: api - fix finding algorithm currently being tested
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, 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; |