[PATCH v3 6/6] s390/crypto: Fix handling of EBUSY in PHMAC when req is pushed to crypto engine

Harald Freudenberger <[email protected]>
Newsgroups org.kernel.vger.linux-crypto,org.kernel.vger.linux-s390
Message-ID <[email protected]>
When a request is transferred to the engine via
crypto_transfer_hash_request_to_engine() there are two return codes
signaling a successful transfer: EINPROGRESS and EBUSY. However the
correct handling of EBUSY was missing and has been added as a return
code indicating a successful transfer to the crypto engine.

Fixes: cbbc675506cc ("crypto: s390 - New s390 specific protected key hash phmac")
Signed-off-by: Harald Freudenberger <[email protected]>
Cc: [email protected] # 6.17+
---
 arch/s390/crypto/phmac_s390.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/s390/crypto/phmac_s390.c b/arch/s390/crypto/phmac_s390.c
index 03ca33ffe6cc..9d77198b22ff 100644
--- a/arch/s390/crypto/phmac_s390.c
+++ b/arch/s390/crypto/phmac_s390.c
@@ -629,6 +629,8 @@ static int phmac_update(struct ahash_request *req)
 		req_ctx->async_op = OP_UPDATE;
 		atomic_inc(&tfm_ctx->via_engine_ctr);
 		rc = crypto_transfer_hash_request_to_engine(phmac_crypto_engine, req);
+		if (rc == -EBUSY)
+			rc = -EINPROGRESS;
 		if (rc != -EINPROGRESS)
 			atomic_dec(&tfm_ctx->via_engine_ctr);
 	}
@@ -667,6 +669,8 @@ static int phmac_final(struct ahash_request *req)
 		req_ctx->async_op = OP_FINAL;
 		atomic_inc(&tfm_ctx->via_engine_ctr);
 		rc = crypto_transfer_hash_request_to_engine(phmac_crypto_engine, req);
+		if (rc == -EBUSY)
+			rc = -EINPROGRESS;
 		if (rc != -EINPROGRESS)
 			atomic_dec(&tfm_ctx->via_engine_ctr);
 	}
@@ -716,6 +720,8 @@ static int phmac_finup(struct ahash_request *req)
 		/* req->async_op has been set to either OP_FINUP or OP_FINAL */
 		atomic_inc(&tfm_ctx->via_engine_ctr);
 		rc = crypto_transfer_hash_request_to_engine(phmac_crypto_engine, req);
+		if (rc == -EBUSY)
+			rc = -EINPROGRESS;
 		if (rc != -EINPROGRESS)
 			atomic_dec(&tfm_ctx->via_engine_ctr);
 	}
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.