crypto: pcrypt - Call crypto layer directly when padata_do_parallel() return -EBUSY
[ Upstream commit 662f2f13e66d3883b9238b0b96b17886179e60e2 ]
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ee5aa9717f
commit
dd8bf8eb5b
@@ -174,8 +174,10 @@ static int pcrypt_aead_encrypt(struct aead_request *req)
|
|||||||
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, &pencrypt);
|
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, &pencrypt);
|
||||||
if (!err)
|
if (!err)
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
if (err == -EBUSY)
|
if (err == -EBUSY) {
|
||||||
return -EAGAIN;
|
/* try non-parallel mode */
|
||||||
|
return crypto_aead_encrypt(creq);
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -220,8 +222,10 @@ static int pcrypt_aead_decrypt(struct aead_request *req)
|
|||||||
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, &pdecrypt);
|
err = pcrypt_do_parallel(padata, &ctx->cb_cpu, &pdecrypt);
|
||||||
if (!err)
|
if (!err)
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
if (err == -EBUSY)
|
if (err == -EBUSY) {
|
||||||
return -EAGAIN;
|
/* try non-parallel mode */
|
||||||
|
return crypto_aead_decrypt(creq);
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user