All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harald Freudenberger <freude@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	herbert@gondor.apana.org.au
Cc: freude@linux.ibm.com, linux-s390@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: [PATCH v7 8/9] s390/crypto: Map EBUSY to EIO when key conversion fails repeatedly
Date: Mon, 31 Aug 2026 10:38:37 +0200	[thread overview]
Message-ID: <20260831083838.3703-9-freude@linux.ibm.com> (raw)
In-Reply-To: <20260831083838.3703-1-freude@linux.ibm.com>

When hardware persistently returns -EBUSY after exhausting retries,
the error propagates to crypto_finalize_*_request(). The crypto API's
completion wrapper treats -EBUSY as a queueing status and swallows it,
preventing the completion callback from firing. This causes callers
using crypto_wait_req() to block indefinitely.

Translate persistent -EBUSY to -EIO after retry exhaustion to ensure
proper error propagation and callback invocation.

Fixes: 6cd87cb5ef6c ("s390/crypto: Rework protected key AES for true asynch support")
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Cc: stable@vger.kernel.org # 6.16+
---
 arch/s390/crypto/paes_s390.c  | 4 ++++
 arch/s390/crypto/phmac_s390.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c
index bcaf1705e639..cf396f6018c2 100644
--- a/arch/s390/crypto/paes_s390.c
+++ b/arch/s390/crypto/paes_s390.c
@@ -220,6 +220,10 @@ static inline int convert_key(const u8 *key, unsigned int keylen,
 				      xflags);
 	}
 
+	/* But finally map -EBUSY to -EIO to indicate an IO failure */
+	if (rc == -EBUSY)
+		rc = -EIO;
+
 out:
 	pr_debug("rc=%d\n", rc);
 	return rc;
diff --git a/arch/s390/crypto/phmac_s390.c b/arch/s390/crypto/phmac_s390.c
index 89c5fa3dced2..44817c3d25cf 100644
--- a/arch/s390/crypto/phmac_s390.c
+++ b/arch/s390/crypto/phmac_s390.c
@@ -341,6 +341,10 @@ static inline int convert_key(const u8 *key, unsigned int keylen,
 				      xflags);
 	}
 
+	/* But finally map -EBUSY to -EIO to indicate an IO failure */
+	if (rc == -EBUSY)
+		rc = -EIO;
+
 out:
 	pr_debug("rc=%d\n", rc);
 	return rc;
-- 
2.43.0


  parent reply	other threads:[~2026-08-31  8:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  8:38 [PATCH v7 0/9] Fixes and rework for paes_s390 and phmac_s390 Harald Freudenberger
2026-08-31  8:38 ` [PATCH v7 1/9] s390/crypto: Fix return code handling at skcipher_walk_done in PAES algorithms Harald Freudenberger
2026-08-31  8:55   ` sashiko-bot
2026-08-31  8:38 ` [PATCH v7 2/9] s390/crypto: Fix missing scrub of temp buffers with PAES algorithm Harald Freudenberger
2026-08-31  9:10   ` sashiko-bot
2026-08-31  8:38 ` [PATCH v7 3/9] s390/crypto: Fix use of mutex in atomic context in PAES Harald Freudenberger
2026-08-31  9:19   ` sashiko-bot
2026-08-31  8:38 ` [PATCH v7 4/9] s390/crypto: Fix missing cra_flags in paes_s390 Harald Freudenberger
2026-08-31  9:32   ` sashiko-bot
2026-08-31  8:38 ` [PATCH v7 5/9] s390/crypto: Fix handling of EBUSY in PAES when req is pushed to crypto engine Harald Freudenberger
2026-08-31  9:45   ` sashiko-bot
2026-08-31  8:38 ` [PATCH v7 6/9] s390/crypto: Fix handling of EBUSY in PHMAC " Harald Freudenberger
2026-08-31  9:58   ` sashiko-bot
2026-08-31  8:38 ` [PATCH v7 7/9] s390/crypto: Fix wrong return code to engine in asynch callbacks Harald Freudenberger
2026-08-31 10:04   ` sashiko-bot
2026-08-31  8:38 ` Harald Freudenberger [this message]
2026-08-31 10:10   ` [PATCH v7 8/9] s390/crypto: Map EBUSY to EIO when key conversion fails repeatedly sashiko-bot
2026-08-31  8:38 ` [PATCH v7 9/9] s390/crypto: Enable CONTEXT_ANALYSIS Harald Freudenberger
2026-08-31 10:11   ` sashiko-bot
2026-09-03 19:36 ` [PATCH v7 0/9] Fixes and rework for paes_s390 and phmac_s390 Heiko Carstens

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=20260831083838.3703-9-freude@linux.ibm.com \
    --to=freude@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-s390@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.