@@ -275,9 +275,15 @@ static int tls_do_decryption(struct sock *sk,
BUILD_BUG_ON_INVALID(atomic_read(&ctx->decrypt_pending) < 1);
atomic_inc(&ctx->decrypt_pending);
} else {
+ DECLARE_CRYPTO_WAIT(wait);
+
aead_request_set_callback(aead_req,
CRYPTO_TFM_REQ_MAY_BACKLOG,
- crypto_req_done, &ctx->async_wait);
+ crypto_req_done, &wait);
+ ret = crypto_aead_decrypt(aead_req);
+ if (ret == -EINPROGRESS || ret == -EBUSY)
+ ret = crypto_wait_req(ret, &wait);
+ return ret;
}
ret = crypto_aead_decrypt(aead_req);
@@ -286,10 +292,7 @@ static int tls_do_decryption(struct sock *sk,
ret = ret ?: -EINPROGRESS;
}
if (ret == -EINPROGRESS) {
- if (darg->async)
- return 0;
-
- ret = crypto_wait_req(ret, &ctx->async_wait);
+ return 0;
} else if (darg->async) {
atomic_dec(&ctx->decrypt_pending);
}