Re: [PATCH net 1/5] net: tls: handle -EBUSY on async encrypt/decrypt requests
flat view
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2023-09-08 06:10:24
Sabrina Dubroca [off-list ref] wrote:
Since we're setting the CRYPTO_TFM_REQ_MAY_BACKLOG flag on our
requests to the crypto API, crypto_aead_{encrypt,decrypt} can return
-EBUSY instead of -EINPROGRESS in valid situations. For example, when
the cryptd queue for AESNI is full (easy to trigger with an
artifically low cryptd.cryptd_max_cpu_qlen), requests will be enqueued
to the backlog but still processed. In that case, the async callback
will also be called twice: first with err == -EINPROGRESS, which it
seems we can just ignore, then with err == 0.
I've only tested this on AESNI with cryptd.
Fixes: a54667f6728c ("tls: Add support for encryption using async offload accelerator")
Fixes: 94524d8fc965 ("net/tls: Add support for async decryption of tls records")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
net/tls/tls_sw.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)You should only use MAY_BACKLOG if you can actually back off and stop issuing new requests. In that case you can only restart issuing new requests when the EINPROGRESS notification comes in. If that's not the case here you should drop MAY_BACKLOG altogether. Cheers, -- Email: Herbert Xu [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt