Skip to content

Commit b81e286

Browse files
committed
crypto: api - Fix liveliness check in crypto_alg_tested
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 <[email protected]>
1 parent 44ac462 commit b81e286

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crypto/algapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void crypto_alg_tested(const char *name, int err)
373373
q->cra_flags |= CRYPTO_ALG_DEAD;
374374
alg = test->adult;
375375

376-
if (list_empty(&alg->cra_list))
376+
if (crypto_is_dead(alg))
377377
goto complete;
378378

379379
if (err == -ECANCELED)

0 commit comments

Comments
 (0)