Commit d0aab7d4 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:
 "This fixes a couple of places in the crypto code that were doing
  interruptible sleeps dangerously. They have been converted to use
  non-interruptible sleeps.

  This also fixes a bug in asymmetric_keys where it would trigger a
  use-after-free if a request returned EBUSY due to a full device queue"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: gcm - wait for crypto op not signal safe
  crypto: drbg - wait for crypto op not signal safe
  crypto: asymmetric_keys - handle EBUSY due to backlog correctly
parents b29794ec f3ad5870
...@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey, ...@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey,
* signature and returns that to us. * signature and returns that to us.
*/ */
ret = crypto_akcipher_verify(req); ret = crypto_akcipher_verify(req);
if (ret == -EINPROGRESS) { if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
wait_for_completion(&compl.completion); wait_for_completion(&compl.completion);
ret = compl.err; ret = compl.err;
} }
......
...@@ -1767,9 +1767,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, ...@@ -1767,9 +1767,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
break; break;
case -EINPROGRESS: case -EINPROGRESS:
case -EBUSY: case -EBUSY:
ret = wait_for_completion_interruptible( wait_for_completion(&drbg->ctr_completion);
&drbg->ctr_completion); if (!drbg->ctr_async_err) {
if (!ret && !drbg->ctr_async_err) {
reinit_completion(&drbg->ctr_completion); reinit_completion(&drbg->ctr_completion);
break; break;
} }
......
...@@ -152,10 +152,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key, ...@@ -152,10 +152,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,
err = crypto_skcipher_encrypt(&data->req); err = crypto_skcipher_encrypt(&data->req);
if (err == -EINPROGRESS || err == -EBUSY) { if (err == -EINPROGRESS || err == -EBUSY) {
err = wait_for_completion_interruptible( wait_for_completion(&data->result.completion);
&data->result.completion); err = data->result.err;
if (!err)
err = data->result.err;
} }
if (err) if (err)
......
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