Skip to content

Commit d0aab7d

Browse files
committed
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
2 parents b29794e + f3ad587 commit d0aab7d

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

crypto/asymmetric_keys/public_key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey,
141141
* signature and returns that to us.
142142
*/
143143
ret = crypto_akcipher_verify(req);
144-
if (ret == -EINPROGRESS) {
144+
if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
145145
wait_for_completion(&compl.completion);
146146
ret = compl.err;
147147
}

crypto/drbg.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,9 +1767,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
17671767
break;
17681768
case -EINPROGRESS:
17691769
case -EBUSY:
1770-
ret = wait_for_completion_interruptible(
1771-
&drbg->ctr_completion);
1772-
if (!ret && !drbg->ctr_async_err) {
1770+
wait_for_completion(&drbg->ctr_completion);
1771+
if (!drbg->ctr_async_err) {
17731772
reinit_completion(&drbg->ctr_completion);
17741773
break;
17751774
}

crypto/gcm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,
152152

153153
err = crypto_skcipher_encrypt(&data->req);
154154
if (err == -EINPROGRESS || err == -EBUSY) {
155-
err = wait_for_completion_interruptible(
156-
&data->result.completion);
157-
if (!err)
158-
err = data->result.err;
155+
wait_for_completion(&data->result.completion);
156+
err = data->result.err;
159157
}
160158

161159
if (err)

0 commit comments

Comments
 (0)