diff --git a/crypto/algapi.c b/crypto/algapi.c index bb8f11aafa6386e482229ad7a0176128326eab8c..1da1ac7494adf81dc4256607528f9f21c793a83e 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -963,6 +963,9 @@ EXPORT_SYMBOL_GPL(crypto_enqueue_request); void crypto_enqueue_request_head(struct crypto_queue *queue, struct crypto_async_request *request) { + if (unlikely(queue->qlen >= queue->max_qlen)) + queue->backlog = queue->backlog->prev; + queue->qlen++; list_add(&request->list, &queue->list); } diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index cff21f4e03e3214052dfd652583f1e51ab2a1809..1ef692b4aff819dc4a229e1be8d2dca024fb4fad 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c @@ -128,9 +128,6 @@ static void crypto_pump_requests(struct crypto_engine *engine, if (!engine->retry_support) engine->cur_req = async_req; - if (backlog) - backlog->complete(backlog, -EINPROGRESS); - if (engine->busy) was_busy = true; else @@ -216,6 +213,9 @@ static void crypto_pump_requests(struct crypto_engine *engine, async_req->complete(async_req, ret); retry: + if (backlog) + backlog->complete(backlog, -EINPROGRESS); + /* If retry mechanism is supported, send new requests to engine */ if (engine->retry_support) { spin_lock_irqsave(&engine->queue_lock, flags);