From: Herbert Xu <herbert@gondor.apana.org.au>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Harald Freudenberger <freude@linux.ibm.com>,
Ingo Franzki <ifranzki@linux.ibm.com>,
linux-crypto@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>,
dengler@linux.ibm.com, linux-s390@vger.kernel.org,
dm-devel@lists.linux.dev, agk@redhat.com, snitzer@kernel.org,
Milan Broz <gmazyland@gmail.com>
Subject: Re: [PATCH] crypto/authenc: don't return -EBUSY when enqueuing the hash request
Date: Tue, 23 Sep 2025 11:47:26 +0800 [thread overview]
Message-ID: <aNIYTm6neC3lC6dP@gondor.apana.org.au> (raw)
In-Reply-To: <e26aedc6-7132-46c3-78f3-a3582b1c4f9a@redhat.com>
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 <mpatocka@redhat.com>
> Cc: stable@vger.kernel.org
>
> ---
> 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 <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2025-09-23 3:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250908131642.385445532@debian4.vm>
[not found] ` <3a6b6f8f-5205-459c-810a-2425aae92fc8@linux.ibm.com>
[not found] ` <e1e420d5-dc00-14d0-fdef-635d6ef70811@redhat.com>
[not found] ` <bb68f9d6-8180-4291-9e6b-33bbdcef780f@linux.ibm.com>
[not found] ` <8cb59ed5-1c9a-49de-beee-01eda52ad618@linux.ibm.com>
[not found] ` <1af710ec-0f23-2522-d715-e683b9e557d8@redhat.com>
[not found] ` <f799d7ab97470f2529b8dcb5566fd673@linux.ibm.com>
2025-09-22 19:08 ` [PATCH] crypto/authenc: don't return -EBUSY when enqueuing the hash request Mikulas Patocka
2025-09-23 3:47 ` Herbert Xu [this message]
2025-09-23 11:14 ` Mikulas Patocka
2025-09-23 14:36 ` Mikulas Patocka
2025-09-23 15:17 ` Herbert Xu
2025-09-24 10:20 ` [PATCH] crypto: authenc - Correctly pass EINPROGRESS back up to the caller Herbert Xu
2025-09-24 13:17 ` Ingo Franzki
2025-11-25 14:02 ` [PATCH] crypto/authenc: don't return -EBUSY when enqueuing the hash request Mikulas Patocka
2025-11-26 5:16 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aNIYTm6neC3lC6dP@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=agk@redhat.com \
--cc=davem@davemloft.net \
--cc=dengler@linux.ibm.com \
--cc=dm-devel@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=freude@linux.ibm.com \
--cc=gmazyland@gmail.com \
--cc=ifranzki@linux.ibm.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox