Re: [PATCH v8 3/3] crypto: Add Inside Secure SafeXcel EIP-93 crypto engine support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux