On Mon, Sep 22, 2025 at 09:08:42PM +0200, Mikulas Patocka wrote: > > When we return -EBUSY from encryption routines, the caller is supposed to > sleep until it receives -EINPROGRESS in the callback method. > > However when using authenc with asynchronous hash, the hash function may > return -EBUSY. In this case, the crypto API never calls the caller with > -EINPROGRESS and it causes deadlock in dm-crypt. > > Fix this by turning -EBUSY into -EINPROGRESS. > > Signed-off-by: Mikulas Patocka <[email protected]> > Cc: [email protected] > > --- > crypto/authenc.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > Index: linux-2.6/crypto/authenc.c > =================================================================== > --- linux-2.6.orig/crypto/authenc.c 2025-09-22 20:32:02.000000000 +0200 > +++ linux-2.6/crypto/authenc.c 2025-09-22 20:35:38.000000000 +0200 > @@ -146,8 +146,11 @@ static int crypto_authenc_genicv(struct > authenc_geniv_ahash_done, req); > > err = crypto_ahash_digest(ahreq); > - if (err) > + if (err) { > + if (err == -EBUSY) > + err = -EINPROGRESS; > return err; > + }
If authenc gets EBUSY from the ahash, then the ahash is responsible for sending an EINPROGRESS notification. I just checked the authenc code and it does pass the notification back up to the caller (which is dm-crypt). So if EINPROGRESS is not being received, then it's a bug in the ahash layer or the underlying ahash algorithm. Which phmac implementation was this? Cheers, -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
