crypto: inside-secure - stop requeueing failed requests
authorAntoine Ténart <antoine.tenart@free-electrons.com>
Thu, 15 Jun 2017 07:56:25 +0000 (09:56 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 20 Jun 2017 03:21:45 +0000 (11:21 +0800)
This update the dequeue function of the inside-secure safexcel driver so
that failed requests aren't requeued when they fail (for whatever
reason, which can be because the hw ring is full).

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/inside-secure/safexcel.c

index 8956b23803a8a62ad0de27e86ad655328d64fd91..8ae133a9e3f24a1fa47082b5b5bb23d6b213fce9 100644 (file)
@@ -439,20 +439,22 @@ void safexcel_dequeue(struct safexcel_crypto_priv *priv, int ring)
                        goto finalize;
 
                request = kzalloc(sizeof(*request), EIP197_GFP_FLAGS(*req));
-               if (!request)
-                       goto requeue;
+               if (!request) {
+                       spin_lock_bh(&priv->ring[ring].queue_lock);
+                       crypto_enqueue_request(&priv->ring[ring].queue, req);
+                       spin_unlock_bh(&priv->ring[ring].queue_lock);
+
+                       priv->ring[ring].need_dequeue = true;
+                       goto finalize;
+               }
 
                ctx = crypto_tfm_ctx(req->tfm);
                ret = ctx->send(req, ring, request, &commands, &results);
                if (ret) {
                        kfree(request);
-requeue:
-                       spin_lock_bh(&priv->ring[ring].queue_lock);
-                       crypto_enqueue_request(&priv->ring[ring].queue, req);
-                       spin_unlock_bh(&priv->ring[ring].queue_lock);
-
+                       req->complete(req, ret);
                        priv->ring[ring].need_dequeue = true;
-                       continue;
+                       goto finalize;
                }
 
                if (backlog)