summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2024-11-15 09:29:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-08 10:01:32 +0100
commit99549fe728f91457dfd073a0e2e913f2afc440f4 (patch)
tree7d6f526e4028a630a66df18beaeb73d2cd605b00 /crypto
parent5eaa7c916e1ec4b122a1c3a8a20e692d9d9e174e (diff)
downloadlinux-99549fe728f91457dfd073a0e2e913f2afc440f4.tar.gz
linux-99549fe728f91457dfd073a0e2e913f2afc440f4.tar.bz2
linux-99549fe728f91457dfd073a0e2e913f2afc440f4.zip
crypto: api - Fix boot-up self-test race
[ Upstream commit 8dd458cbc5be9ce4427ffce7a9dcdbff4dfc4ac9 ] During the boot process self-tests are postponed so that all algorithms are registered when the test starts. In the event that algorithms are still being registered during these tests, which can occur either because the algorithm is registered at late_initcall, or because a self-test itself triggers the creation of an instance, some self-tests may never start at all. Fix this by setting the flag at the start of crypto_start_tests. Note that this race is theoretical and has never been observed in practice. Fixes: adad556efcdd ("crypto: api - Fix built-in testing dependency failures") Signed-off-by: Herbert Xu <herbert.xu@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/algapi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 16f7c7a9d8ab..7e061d8a1d52 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -1016,6 +1016,8 @@ static void __init crypto_start_tests(void)
if (IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS))
return;
+ set_crypto_boot_test_finished();
+
for (;;) {
struct crypto_larval *larval = NULL;
struct crypto_alg *q;
@@ -1047,8 +1049,6 @@ static void __init crypto_start_tests(void)
if (!larval)
break;
}
-
- set_crypto_boot_test_finished();
}
static int __init crypto_algapi_init(void)