Re: [RFC PATCH 0/2] crypto: caam - fix cts(cbc(aes)) with CAAM driver
From: Herbert Xu
Date: Fri Jun 16 2017 - 04:00:15 EST
On Fri, Jun 16, 2017 at 07:57:00AM +0000, Horia GeantÄ wrote:
> Commit 0605c41cc53ca ("crypto: cts - Convert to skcipher") appends
> CRYPTO_TFM_REQ_MAY_BACKLOG to the original crypto request flags for the
> last block - when calling cts_cbc_encrypt().
> Is it really needed?
Yes, because at this point we cannot tell the sender to back off.
> For cts(cbc(aes)) with cbc(aes) offloaded in HW, i.e. running in async
> mode, we get the below stack for CAAM driver.
> Driver is told that it can sleep (CRYPTO_TFM_REQ_MAY_BACKLOG flag), so
> it uses GFP_KERNEL to allocate memory. However, this is incorrect, since
> driver runs in atomic context (softirq).
This is wrong. Whether you can sleep or not is determined by
MAY_SLEEP, not MAY_BACKLOG. MAY_BACKLOG only indicates that this
request must be queued, even if the queue is full.
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt