diff mbox series

crypto: pcrypt - Call crypto layer directly when padata_do_parallel() return -EBUSY

Message ID 20241015020935.296691-1-yiyang13@huawei.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: pcrypt - Call crypto layer directly when padata_do_parallel() return -EBUSY | expand

Commit Message

Yi Yang Oct. 15, 2024, 2:09 a.m. UTC
Since commit 8f4f68e788c3 ("crypto: pcrypt - Fix hungtask for
PADATA_RESET"), the pcrypt encryption and decryption operations return
-EAGAIN when the CPU goes online or offline. In alg_test(), a WARN is
generated when pcrypt_aead_decrypt() or pcrypt_aead_encrypt() returns
-EAGAIN, the unnecessary panic will occur when panic_on_warn set 1.
Fix this issue by calling crypto layer directly without parallelization
in that case.

Fixes: 8f4f68e788c3 ("crypto: pcrypt - Fix hungtask for PADATA_RESET")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
 crypto/pcrypt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Herbert Xu Oct. 26, 2024, 6:55 a.m. UTC | #1
On Tue, Oct 15, 2024 at 02:09:35AM +0000, Yi Yang wrote:
> Since commit 8f4f68e788c3 ("crypto: pcrypt - Fix hungtask for
> PADATA_RESET"), the pcrypt encryption and decryption operations return
> -EAGAIN when the CPU goes online or offline. In alg_test(), a WARN is
> generated when pcrypt_aead_decrypt() or pcrypt_aead_encrypt() returns
> -EAGAIN, the unnecessary panic will occur when panic_on_warn set 1.
> Fix this issue by calling crypto layer directly without parallelization
> in that case.
> 
> Fixes: 8f4f68e788c3 ("crypto: pcrypt - Fix hungtask for PADATA_RESET")
> Signed-off-by: Yi Yang <yiyang13@huawei.com>
> ---
>  crypto/pcrypt.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index d0d954fe9d54..7fc79e7dce44 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -117,8 +117,10 @@  static int pcrypt_aead_encrypt(struct aead_request *req)
 	err = padata_do_parallel(ictx->psenc, padata, &ctx->cb_cpu);
 	if (!err)
 		return -EINPROGRESS;
-	if (err == -EBUSY)
-		return -EAGAIN;
+	if (err == -EBUSY) {
+		/* try non-parallel mode */
+		return crypto_aead_encrypt(creq);
+	}
 
 	return err;
 }
@@ -166,8 +168,10 @@  static int pcrypt_aead_decrypt(struct aead_request *req)
 	err = padata_do_parallel(ictx->psdec, padata, &ctx->cb_cpu);
 	if (!err)
 		return -EINPROGRESS;
-	if (err == -EBUSY)
-		return -EAGAIN;
+	if (err == -EBUSY) {
+		/* try non-parallel mode */
+		return crypto_aead_decrypt(creq);
+	}
 
 	return err;
 }