Like the previous commit, pass the algorithm by pointer instead of by name in order to make sure we mark the algorithm that was actually tested and not some other algorithm that has the same name.
Signed-off-by: Vegard Nossum <vegard.nos...@oracle.com> --- crypto/algapi.c | 9 +++------ crypto/algboss.c | 2 +- crypto/internal.h | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/crypto/algapi.c b/crypto/algapi.c index 29076797a938..8b4a1903557e 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -366,10 +366,9 @@ __crypto_register_alg(struct crypto_alg *alg, struct list_head *algs_to_put) goto out; } -void crypto_alg_tested(const char *name, int err) +void crypto_alg_tested(struct crypto_alg *alg, int err) { struct crypto_larval *test; - struct crypto_alg *alg; struct crypto_alg *q; LIST_HEAD(list); @@ -379,18 +378,16 @@ void crypto_alg_tested(const char *name, int err) continue; test = (struct crypto_larval *)q; - - if (!strcmp(q->cra_driver_name, name)) + if (test->adult == alg) goto found; } - pr_err("alg: Unexpected test result for %s: %d\n", name, err); + pr_err("alg: Unexpected test result for %s: %d\n", alg->cra_driver_name, err); up_write(&crypto_alg_sem); return; found: q->cra_flags |= CRYPTO_ALG_DEAD; - alg = test->adult; if (crypto_is_dead(alg)) goto complete; diff --git a/crypto/algboss.c b/crypto/algboss.c index 31df14e37a3e..2599c54a49ff 100644 --- a/crypto/algboss.c +++ b/crypto/algboss.c @@ -172,7 +172,7 @@ static int cryptomgr_test(void *data) err = alg_test(alg, alg->cra_driver_name, alg->cra_name, alg->cra_flags, CRYPTO_ALG_TESTED); - crypto_alg_tested(alg->cra_driver_name, err); + crypto_alg_tested(alg, err); crypto_mod_put(alg); module_put_and_kthread_exit(0); diff --git a/crypto/internal.h b/crypto/internal.h index 702934c719ef..1000ce8de06c 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -114,7 +114,7 @@ struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask); struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask); void crypto_schedule_test(struct crypto_larval *larval); -void crypto_alg_tested(const char *name, int err); +void crypto_alg_tested(struct crypto_alg *alg, int err); void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list, struct crypto_alg *nalg); -- 2.39.3