From: Eric Biggers <ebiggers@kernel.org>
To: stable@vger.kernel.org
Cc: linux-crypto@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 6.1 1/3] Revert "crypto: jitterentropy - replace long-held spinlock with mutex"
Date: Fri, 30 Oct 2026 10:02:18 -0700 [thread overview]
Message-ID: <20261030170220.120015-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20261030170220.120015-1-ebiggers@kernel.org>
This reverts commit 21de77d06f6b540e870e64ef5ff56be4eb8ba08f.
This is needed to cleanly revert commit fc659f1a6903 ("crypto: jitter -
replace LFSR with SHA3-256"). It will be reapplied.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/jitterentropy-kcapi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index 74d5c8da0e8ab..4b50cbc8a2faf 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -42,7 +42,6 @@
#include <linux/fips.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <crypto/internal/rng.h>
@@ -181,7 +180,7 @@ int jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len)
***************************************************************************/
struct jitterentropy {
- struct mutex jent_lock;
+ spinlock_t jent_lock;
struct rand_data *entropy_collector;
struct crypto_shash *tfm;
struct shash_desc *sdesc;
@@ -191,7 +190,7 @@ static void jent_kcapi_cleanup(struct crypto_tfm *tfm)
{
struct jitterentropy *rng = crypto_tfm_ctx(tfm);
- mutex_lock(&rng->jent_lock);
+ spin_lock(&rng->jent_lock);
if (rng->sdesc) {
shash_desc_zero(rng->sdesc);
@@ -206,7 +205,7 @@ static void jent_kcapi_cleanup(struct crypto_tfm *tfm)
if (rng->entropy_collector)
jent_entropy_collector_free(rng->entropy_collector);
rng->entropy_collector = NULL;
- mutex_unlock(&rng->jent_lock);
+ spin_unlock(&rng->jent_lock);
}
static int jent_kcapi_init(struct crypto_tfm *tfm)
@@ -216,7 +215,7 @@ static int jent_kcapi_init(struct crypto_tfm *tfm)
struct shash_desc *sdesc;
int size, ret = 0;
- mutex_init(&rng->jent_lock);
+ spin_lock_init(&rng->jent_lock);
/*
* Use SHA3-256 as conditioner. We allocate only the generic
@@ -251,6 +250,7 @@ static int jent_kcapi_init(struct crypto_tfm *tfm)
goto err;
}
+ spin_lock_init(&rng->jent_lock);
return 0;
err:
@@ -265,7 +265,7 @@ static int jent_kcapi_random(struct crypto_rng *tfm,
struct jitterentropy *rng = crypto_rng_ctx(tfm);
int ret = 0;
- mutex_lock(&rng->jent_lock);
+ spin_lock(&rng->jent_lock);
ret = jent_read_entropy(rng->entropy_collector, rdata, dlen);
@@ -291,7 +291,7 @@ static int jent_kcapi_random(struct crypto_rng *tfm,
ret = -EINVAL;
}
- mutex_unlock(&rng->jent_lock);
+ spin_unlock(&rng->jent_lock);
return ret;
}
--
2.56.0
next prev parent reply other threads:[~2026-10-30 17:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 17:02 [PATCH 6.1 0/3] Fix incorrect backports Eric Biggers
2026-10-30 17:02 ` Eric Biggers [this message]
2026-10-30 17:02 ` [PATCH 6.1 2/3] Revert "crypto: jitter - replace LFSR with SHA3-256" Eric Biggers
2026-10-30 17:02 ` [PATCH 6.1 3/3] crypto: jitterentropy - replace long-held spinlock with mutex Eric Biggers
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=20261030170220.120015-2-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=stable@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