crypto: api - Ensure cra_type->destroy is done in process context

Move the cra_type->destroy call out of crypto_alg_put and into
crypto_unregister_alg and crypto_free_instance.  This ensures
that it's always done in process context so calls such as flush_work
can be done.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Herbert Xu
2025-03-17 16:33:57 +08:00
parent 3860642e0a
commit 138804c2c1
3 changed files with 11 additions and 15 deletions

View File

@@ -703,15 +703,5 @@ void crypto_req_done(void *data, int err)
}
EXPORT_SYMBOL_GPL(crypto_req_done);
void crypto_destroy_alg(struct crypto_alg *alg)
{
if (alg->cra_type && alg->cra_type->destroy)
alg->cra_type->destroy(alg);
if (alg->cra_destroy)
alg->cra_destroy(alg);
}
EXPORT_SYMBOL_GPL(crypto_destroy_alg);
MODULE_DESCRIPTION("Cryptographic core API");
MODULE_LICENSE("GPL");