Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Heiko Carstens" <hca@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [PATCH 3/3] s390/crypto: Enable CONTEXT_ANALYSIS
Date: Tue, 04 Aug 2026 11:45:26 +0000	[thread overview]
Message-ID: <20260804114527.414C01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804113736.1423667-4-hca@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing error check for `skcipher_walk_virt()` in `ctr_aes_crypt()` causes errors to be silently swallowed.
--

--- Patch [3]: [PATCH 3/3] s390/crypto: Enable CONTEXT_ANALYSIS ---
commit 2232f8277d7ab7cfce4ac97a8923bcf8c4ed60e3
Author: Heiko Carstens <hca@linux.ibm.com>

s390/crypto: Enable CONTEXT_ANALYSIS

Enable CONTEXT_ANALYSIS since s390's crypto code compiles now without
warnings.

> diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile
> index 48aeb0c0ffbd6..1d64208139357 100644
> --- a/arch/s390/crypto/Makefile
> +++ b/arch/s390/crypto/Makefile
> @@ -3,6 +3,8 @@
>  # Cryptographic API
>  #
>  
> +CONTEXT_ANALYSIS := y
> +

[Severity: High]
Does this code silently swallow errors from skcipher_walk_virt()?

In arch/s390/crypto/aes_s390.c:ctr_aes_crypt():

	ret = skcipher_walk_virt(&walk, req, false);

	if (mutex_trylock(&ctrblk_lock)) {
		ret = __ctr_aes_crypt(sctx, &walk, true);
		mutex_unlock(&ctrblk_lock);
	} else {
		ret = __ctr_aes_crypt(sctx, &walk, false);
	}

If memory allocation or scatterlist setup fails during skcipher_walk_virt(),
it returns an error code (such as -ENOMEM or -EINVAL). Because ret is
immediately overwritten by __ctr_aes_crypt() without being checked, the
caller may incorrectly receive 0 (success).

This causes a silent failure where unencrypted or undecrypted data may be
consumed by the caller.

Could we add an error check before calling __ctr_aes_crypt()?

>  obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260804113736.1423667-1-hca@linux.ibm.com?part=3

      reply	other threads:[~2026-08-04 11:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 11:37 [PATCH 0/3] s390/crypto: Enable CONTEXT_ANALYSIS Heiko Carstens
2026-08-04 11:37 ` [PATCH 1/3] s390/crypto: Rework ctr_aes_crypt() to remove conditional locking Heiko Carstens
2026-08-04 11:44   ` sashiko-bot
2026-08-04 11:37 ` [PATCH 2/3] s390/crypto: Rework ctr_paes_do_crypt() " Heiko Carstens
2026-08-04 11:47   ` sashiko-bot
2026-08-04 12:47     ` Heiko Carstens
2026-08-05  8:47       ` Harald Freudenberger
2026-08-04 11:37 ` [PATCH 3/3] s390/crypto: Enable CONTEXT_ANALYSIS Heiko Carstens
2026-08-04 11:45   ` sashiko-bot [this message]

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=20260804114527.414C01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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