summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2024-10-06 09:18:37 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-17 15:08:56 +0100
commit83394e7d94216eeada68f8de46d6baef3daadc8f (patch)
treeda7fe8f088b2f22d45e51b3730c0b38006d7d7fe /crypto
parentd22f177935dd874d59887d0d3f1d7b054fc7124b (diff)
downloadlinux-83394e7d94216eeada68f8de46d6baef3daadc8f.tar.gz
linux-83394e7d94216eeada68f8de46d6baef3daadc8f.tar.bz2
linux-83394e7d94216eeada68f8de46d6baef3daadc8f.zip
crypto: api - Fix liveliness check in crypto_alg_tested
[ Upstream commit b81e286ba154a4e0f01a94d99179a97f4ba3e396 ] As algorithm testing is carried out without holding the main crypto lock, it is always possible for the algorithm to go away during the test. So before crypto_alg_tested updates the status of the tested alg, it checks whether it's still on the list of all algorithms. This is inaccurate because it may be off the main list but still on the list of algorithms to be removed. Updating the algorithm status is safe per se as the larval still holds a reference to it. However, killing spawns of other algorithms that are of lower priority is clearly a deficiency as it adds unnecessary churn. Fix the test by checking whether the algorithm is dead. 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 85bc279b4233..b3a608604253 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -396,7 +396,7 @@ found:
q->cra_flags |= CRYPTO_ALG_DEAD;
alg = test->adult;
- if (list_empty(&alg->cra_list))
+ if (crypto_is_dead(alg))
goto complete;
if (err == -ECANCELED)