Re: [PATCH] [RFC] crypto: ccree - fix retry handling in cc_send_sync_request()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 28, 2020 at 9:09 PM Geert Uytterhoeven
<geert+renesas@xxxxxxxxx> wrote:
>
> If cc_queues_status() indicates that the queue is full,
> cc_send_sync_request() should loop and retry.
>
> However, cc_queues_status() returns either 0 (for success), or -ENOSPC
> (for queue full), while cc_send_sync_request() checks for real errors by
> comparing with -EAGAIN.  Hence -ENOSPC is always considered a real
> error, and the code never retries the operation.
>
> Fix this by just removing the check, as cc_queues_status() never returns
> any other error value than -ENOSPC.

Thank you for spotting this!

The error is simply checking for the wrong error value.
We should be checking for -ENOSPC!

What this does aims to do is wait for the hardware queue to free up if
we were asked to queue a synchronous request and there was no room in
the hardware queue.
The cc_queue_status() function used to return -EAGAIN in this scenario
and this was missed in the change.

I'm curious as to how you found this - did you run into some problem
and traced it to this?
This can lead to a setkey() failing in very high load situations but I
expect this occurrence to be very rare indeed since cc_queue_status()
already loops several times waiting for the room to be freeed.


Gilad



-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux