From: Harald Freudenberger <freude@linux.ibm.com>
To: dengler@linux.ibm.com, fcallies@linux.ibm.com
Cc: freude@linux.ibm.com, linux-s390@vger.kernel.org,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>
Subject: [PATCH v1 2/2] s390/crypto: Handle cpacf_kma() return code
Date: Mon, 5 Oct 2026 16:14:16 +0200 [thread overview]
Message-ID: <20261005141417.65822-3-freude@linux.ibm.com> (raw)
In-Reply-To: <20261005141417.65822-1-freude@linux.ibm.com>
Now that cpacf_kma() returns the condition code, check it and bail out
with -EIO on any non-zero result. In practice CC 1 and CC 2 cannot
occur: the GCM function codes are clear-key only, and the scatterwalk
loop ensures block-aligned chunks with LAAD/LPC set on the final call.
However, it is a defensive improvement, not a bug fix.
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
---
arch/s390/crypto/aes_s390.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 0be6fa779d2c..ec88ce88f3ef 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -905,10 +905,13 @@ static int gcm_aes_crypt(struct aead_request *req, unsigned int flags)
if (aad_bytes > 0)
memcpy(gw_out.ptr, gw_in.ptr, aad_bytes);
- cpacf_kma(ctx->fc | flags, ¶m,
- gw_out.ptr + aad_bytes,
- gw_in.ptr + aad_bytes, pc_bytes,
- gw_in.ptr, aad_bytes);
+ if (cpacf_kma(ctx->fc | flags, ¶m,
+ gw_out.ptr + aad_bytes,
+ gw_in.ptr + aad_bytes, pc_bytes,
+ gw_in.ptr, aad_bytes)) {
+ ret = -EIO;
+ goto out;
+ }
n = aad_bytes + pc_bytes;
if (gcm_in_walk_done(&gw_in, n) != n) {
--
2.43.0
next prev parent reply other threads:[~2026-10-05 14:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 14:14 [PATCH v1 0/2] Rework cpacf_kma() function Harald Freudenberger
2026-10-05 14:14 ` [PATCH v1 1/2] s390/cpacf: Rework cpacf_kma() to return condition code Harald Freudenberger
2026-10-05 14:23 ` sashiko-bot
2026-10-06 7:48 ` Holger Dengler
2026-10-06 8:30 ` Heiko Carstens
2026-10-06 13:29 ` Harald Freudenberger
2026-10-06 13:39 ` Heiko Carstens
2026-10-06 14:16 ` Harald Freudenberger
2026-10-06 15:13 ` Heiko Carstens
2026-10-05 14:14 ` Harald Freudenberger [this message]
2026-10-05 14:20 ` [PATCH v1 2/2] s390/crypto: Handle cpacf_kma() return code sashiko-bot
2026-10-06 7:52 ` Holger Dengler
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=20261005141417.65822-3-freude@linux.ibm.com \
--to=freude@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=dengler@linux.ibm.com \
--cc=fcallies@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox