diff mbox

[BUGFIX] crypto: atmel: only treat EBUSY as transient if backlog

Message ID 1498634523-2660-1-git-send-email-gilad@benyossef.com
State Accepted
Commit 1606043f214f912a52195293614935811a6e3e53
Headers show

Commit Message

Gilad Ben-Yossef June 28, 2017, 7:22 a.m. UTC
The Atmel SHA driver was treating -EBUSY as indication of queueing
to backlog without checking that backlog is enabled for the request.

Fix it by checking request flags.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>

---

Please note I do not have access to the hardware or know it very well,
so this patch was only compile tested.  I ran into this while working
on a crypto API change and it seemed wrong.

Please review and test if you can!

 drivers/crypto/atmel-sha.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.1.4

Comments

Herbert Xu July 12, 2017, 10:51 a.m. UTC | #1
On Wed, Jun 28, 2017 at 10:22:03AM +0300, Gilad Ben-Yossef wrote:
> The Atmel SHA driver was treating -EBUSY as indication of queueing

> to backlog without checking that backlog is enabled for the request.

> 

> Fix it by checking request flags.

> 

> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>


Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff mbox

Patch

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index a948202..dad4e5b 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -1204,7 +1204,9 @@  static int atmel_sha_finup(struct ahash_request *req)
 	ctx->flags |= SHA_FLAGS_FINUP;
 
 	err1 = atmel_sha_update(req);
-	if (err1 == -EINPROGRESS || err1 == -EBUSY)
+	if (err1 == -EINPROGRESS ||
+	    (err1 == -EBUSY && (ahash_request_flags(req) &
+				CRYPTO_TFM_REQ_MAY_BACKLOG)))
 		return err1;
 
 	/*