All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Harald Freudenberger" <freude@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v2 3/6] s390/crypto: Fix use of mutex in atomic context in PAES
Date: Mon, 17 Aug 2026 10:50:59 +0000	[thread overview]
Message-ID: <20260817105059.658DF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260817104203.74033-4-freude@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The exact same `mutex_trylock()` in atomic context bug fixed by this patch in PAES is also present in standard AES CTR (`arch/s390/crypto/aes_s390.c`) but was left unpatched.
--

--- Patch [3]: [PATCH v2 3/6] s390/crypto: Fix use of mutex in atomic context in PAES ---
commit e6433be4cd856ce7a9d00fbe2d231629541a50c3
Author: Harald Freudenberger <freude@linux.ibm.com>

s390/crypto: Fix use of mutex in atomic context in PAES

This commit replaces a mutex with a binary semaphore in the PAES CTR
implementation. This prevents panics or lockdep warnings when the CTR
processing is called from atomic or interrupt contexts.

> diff --git a/arch/s390/crypto/paes_s390.c b/arch/s390/crypto/paes_s390.c
> index d075b0241f1f5..e8bbfc376ebb1 100644
> --- a/arch/s390/crypto/paes_s390.c
> +++ b/arch/s390/crypto/paes_s390.c
[ ... ]
> @@ -971,7 +972,7 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx,
>  	if (rc)
>  		goto out;
>  
> -	locked = mutex_trylock(&ctrblk_lock);
> +	locked = down_trylock(&ctrblk_sem) == 0;

[Severity: High]
This isn't a bug introduced by this patch, but does the same fix need to be
applied to the standard AES CTR implementation in
arch/s390/crypto/aes_s390.c?

Looking at ctr_aes_crypt() in that file, it uses the exact same locking
pattern:

arch/s390/crypto/aes_s390.c:ctr_aes_crypt() {
    ...
    locked = mutex_trylock(&ctrblk_lock);
    ...
    if (locked)
        mutex_unlock(&ctrblk_lock);
    ...
}

Since skcipher algorithms can be called from atomic or softirq contexts
during operations like ipsec network packet processing, could this similarly
trigger a panic or lockdep warning?

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

  reply	other threads:[~2026-08-17 10:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 10:41 [PATCH v2 0/6] Fixes and rework for paes_s390 Harald Freudenberger
2026-08-17 10:41 ` [PATCH v2 1/6] s390/crypto: Fix return code handling at skcipher_walk_done in PAES algorithms Harald Freudenberger
2026-08-17 11:01   ` sashiko-bot
2026-08-17 10:41 ` [PATCH v2 2/6] s390/crypto: Fix missing scrub of temp buffers with PAES algorithm Harald Freudenberger
2026-08-17 10:52   ` sashiko-bot
2026-08-17 10:42 ` [PATCH v2 3/6] s390/crypto: Fix use of mutex in atomic context in PAES Harald Freudenberger
2026-08-17 10:50   ` sashiko-bot [this message]
2026-08-17 10:42 ` [PATCH v2 4/6] s390/crypto: Fix missing cra_flags in paes_s390 Harald Freudenberger
2026-08-17 10:57   ` sashiko-bot
2026-08-17 10:42 ` [PATCH v2 5/6] s390/crypto: Fix handling of EBUSY in PAES when req is pushed to crypto engine Harald Freudenberger
2026-08-17 10:58   ` sashiko-bot
2026-08-17 10:42 ` [PATCH v2 6/6] s390/crypto: Fix handling of EBUSY in PHMAC " Harald Freudenberger
2026-08-17 10:56   ` sashiko-bot

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=20260817105059.658DF1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=freude@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 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.