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 Wed, Dec 11, 2024 at 05:30:56PM +0800, Herbert Xu wrote:
> 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.
>

It's problematic for the ring consumption logic to free the block as
they get consumed hence memory allocation is needed.

> The preferred way to access extra memory is through the request
> context structure.
>

Do you have quick example for this?

-- 
	Ansuel




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