diff options
author | Gilad Ben-Yossef <gilad@benyossef.com> | 2017-10-18 03:00:33 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-11-03 10:11:16 -0400 |
commit | 6b80ea389a0bceee6a0a801474b78ad0a8cd034d (patch) | |
tree | 6f4725c6a0ac6c093a1f6dc4077fb40865cf3882 /crypto/algapi.c | |
parent | c8dd5e456d2483f051bc92f9c67f01144d122a0b (diff) |
crypto: change transient busy return code to -ENOSPC
The crypto API was using the -EBUSY return value to indicate
both a hard failure to submit a crypto operation into a
transformation provider when the latter was busy and the backlog
mechanism was not enabled as well as a notification that the
operation was queued into the backlog when the backlog mechanism
was enabled.
Having the same return code indicate two very different conditions
depending on a flag is both error prone and requires extra runtime
check like the following to discern between the cases:
if (err == -EINPROGRESS ||
(err == -EBUSY && (ahash_request_flags(req) &
CRYPTO_TFM_REQ_MAY_BACKLOG)))
This patch changes the return code used to indicate a crypto op
failed due to the transformation provider being transiently busy
to -ENOSPC.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r-- | crypto/algapi.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index aa699ff6c876..60d7366ed343 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -897,9 +897,11 @@ int crypto_enqueue_request(struct crypto_queue *queue, | |||
897 | int err = -EINPROGRESS; | 897 | int err = -EINPROGRESS; |
898 | 898 | ||
899 | if (unlikely(queue->qlen >= queue->max_qlen)) { | 899 | if (unlikely(queue->qlen >= queue->max_qlen)) { |
900 | err = -EBUSY; | 900 | if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) { |
901 | if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) | 901 | err = -ENOSPC; |
902 | goto out; | 902 | goto out; |
903 | } | ||
904 | err = -EBUSY; | ||
903 | if (queue->backlog == &queue->list) | 905 | if (queue->backlog == &queue->list) |
904 | queue->backlog = &request->list; | 906 | queue->backlog = &request->list; |
905 | } | 907 | } |