Re: [PATCH] crypto: eip93: fix sleep inside atomic
From: Herbert Xu
Date: Fri Jan 30 2026 - 03:05:23 EST
On Tue, Jan 20, 2026 at 10:54:00AM +0800, Qingfang Deng wrote:
> A crypto request is allowed to sleep only if CRYPTO_TFM_REQ_MAY_SLEEP is
> set. Avoid GFP_KERNEL and usleep_range() if the flag is absent.
>
> Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
> Signed-off-by: Qingfang Deng <dqfext@xxxxxxxxx>
> ---
> .../crypto/inside-secure/eip93/eip93-aead.c | 2 +-
> .../crypto/inside-secure/eip93/eip93-cipher.c | 2 +-
> .../crypto/inside-secure/eip93/eip93-cipher.h | 3 +-
> .../crypto/inside-secure/eip93/eip93-common.c | 36 ++++++++++++-------
> .../crypto/inside-secure/eip93/eip93-hash.c | 9 +++--
> 5 files changed, 35 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/crypto/inside-secure/eip93/eip93-aead.c b/drivers/crypto/inside-secure/eip93/eip93-aead.c
> index 18dd8a9a5165..b5a47b583397 100644
> --- a/drivers/crypto/inside-secure/eip93/eip93-aead.c
> +++ b/drivers/crypto/inside-secure/eip93/eip93-aead.c
> @@ -46,7 +46,7 @@ static int eip93_aead_send_req(struct crypto_async_request *async)
> struct eip93_cipher_reqctx *rctx = aead_request_ctx(req);
> int err;
>
> - err = check_valid_request(rctx);
> + err = check_valid_request(async, rctx);
> if (err) {
> aead_request_complete(req, err);
The aead_request_complete call is buggy too as you cannot call it
unless you're in the async path, which this clearly is not since
you're still checking the request flags.
I think a better solution is to add crypto_engine to this driver
which would guarantee a sleepable context for the driver.
Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt