summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIuliana Prodan <iuliana.prodan@nxp.com>2020-05-20 01:17:25 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2020-05-28 17:27:52 +1000
commitac64e90452fd70ce42917e4fe09f1addfa4c3c50 (patch)
treeac4a7cc529e6e567a66be5ae7bbb22f15ef0db1c
parent069138d6476bc303313c4d36a57b90dc67345b49 (diff)
downloadlinux-crypto-ac64e90452fd70ce42917e4fe09f1addfa4c3c50.tar.gz
linux-crypto-ac64e90452fd70ce42917e4fe09f1addfa4c3c50.zip
crypto: engine - do not requeue in case of fatal error
Now, in crypto-engine, if hardware queue is full (-ENOSPC), requeue request regardless of MAY_BACKLOG flag. If hardware throws any other error code (like -EIO, -EINVAL, -ENOMEM, etc.) only MAY_BACKLOG requests are enqueued back into crypto-engine's queue, since the others can be dropped. The latter case can be fatal error, so those cannot be recovered from. For example, in CAAM driver, -EIO is returned in case the job descriptor is broken, so there is no possibility to fix the job descriptor. Therefore, these errors might be fatal error, so we shouldn’t requeue the request. This will just be pass back and forth between crypto-engine and hardware. Fixes: 0eadd1eb3fd1 ("crypto: engine - support for parallel requests based on retry mechanism") Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Reported-by: Horia Geantă <horia.geanta@nxp.com> Reviewed-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/crypto_engine.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c
index 412149e8..3655d9d3 100644
--- a/crypto/crypto_engine.c
+++ b/crypto/crypto_engine.c
@@ -169,13 +169,10 @@ start_request:
/*
* If hardware queue is full (-ENOSPC), requeue request
* regardless of backlog flag.
- * If hardware throws any other error code,
- * requeue only backlog requests.
* Otherwise, unprepare and complete the request.
*/
if (!engine->retry_support ||
- ((ret != -ENOSPC) &&
- !(async_req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))) {
+ (ret != -ENOSPC)) {
dev_err(engine->dev,
"Failed to do one request from queue: %d\n",
ret);