[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1lb0ImxhhFs4Kuz@gondor.apana.org.au>
Date: Wed, 11 Dec 2024 17:30:56 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Antoine Tenart <atenart@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, linux-crypto@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, upstream@...oha.com,
Richard van Schagen <vschagen@...oud.com>
Subject: Re: [PATCH v8 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto
engine support
On Tue, Dec 10, 2024 at 09:48:33PM +0100, Christian Marangi wrote:
>
> + /*
> + * Consume remaining data.
> + * 1. Loop until we consume all the data in block of 64bytes
> + * 2. Send full block of 64bytes
> + * 3. Skip sending last block for future update() or for final() to
> + * enable HASH_FINALIZE bit.
> + */
> + while (to_consume > 0) {
> + int to_read = min(to_consume, SHA256_BLOCK_SIZE);
> +
> + block = kzalloc(sizeof(*block), GFP_KERNEL);
You should avoid allocating memory. If you really must do it,
then it needs to be GFP_ATOMIC, and your algorithm needs to set
CRYPTO_ALG_ALLOCATES_MEMORY which means that it won't be used
by the storage layer as memory allocations may lead to dead-lock.
The preferred way to access extra memory is through the request
context structure.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists