Commit 6e041ffc authored by Linus Torvalds's avatar Linus Torvalds

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
parents cac26428 eea0d3ea
...@@ -204,9 +204,14 @@ static struct crypto_alg *crypto_alg_lookup(const char *name, u32 type, ...@@ -204,9 +204,14 @@ static struct crypto_alg *crypto_alg_lookup(const char *name, u32 type,
down_read(&crypto_alg_sem); down_read(&crypto_alg_sem);
alg = __crypto_alg_lookup(name, type | test, mask | test); alg = __crypto_alg_lookup(name, type | test, mask | test);
if (!alg && test) if (!alg && test) {
alg = __crypto_alg_lookup(name, type, mask) ? alg = __crypto_alg_lookup(name, type, mask);
ERR_PTR(-ELIBBAD) : NULL; if (alg && !crypto_is_larval(alg)) {
/* Test failed */
crypto_mod_put(alg);
alg = ERR_PTR(-ELIBBAD);
}
}
up_read(&crypto_alg_sem); up_read(&crypto_alg_sem);
return alg; return alg;
......
...@@ -1134,8 +1134,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg) ...@@ -1134,8 +1134,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
if (!drbg) if (!drbg)
return; return;
kzfree(drbg->Vbuf); kzfree(drbg->Vbuf);
drbg->Vbuf = NULL;
drbg->V = NULL; drbg->V = NULL;
kzfree(drbg->Cbuf); kzfree(drbg->Cbuf);
drbg->Cbuf = NULL;
drbg->C = NULL; drbg->C = NULL;
kzfree(drbg->scratchpadbuf); kzfree(drbg->scratchpadbuf);
drbg->scratchpadbuf = NULL; drbg->scratchpadbuf = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment