From: Herbert Xu Date: Sun, 16 Mar 2025 09:50:24 +0000 (+0800) Subject: crypto: api - Call crypto_alg_put in crypto_unregister_alg X-Git-Tag: v6.15-rc1~118^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27b13425349e94ad77b174b032674097cab241c8;p=thirdparty%2Fkernel%2Flinux.git crypto: api - Call crypto_alg_put in crypto_unregister_alg Instead of calling cra_destroy by hand, call it through crypto_alg_put so that the correct unwinding functions are called through crypto_destroy_alg. Fixes: 3d6979bf3bd5 ("crypto: api - Add cra_type->destroy hook") Signed-off-by: Herbert Xu --- diff --git a/crypto/algapi.c b/crypto/algapi.c index e7a9a2ada2cf8..ea9ed9580aa82 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -464,8 +464,7 @@ void crypto_unregister_alg(struct crypto_alg *alg) if (WARN_ON(refcount_read(&alg->cra_refcnt) != 1)) return; - if (alg->cra_destroy) - alg->cra_destroy(alg); + crypto_alg_put(alg); crypto_remove_final(&list); }