]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: api - Call crypto_alg_put in crypto_unregister_alg
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 16 Mar 2025 09:50:24 +0000 (17:50 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Mar 2025 09:39:06 +0000 (17:39 +0800)
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 <herbert@gondor.apana.org.au>
crypto/algapi.c

index e7a9a2ada2cf89df0ee28434f4eab79396a83c73..ea9ed9580aa82935b7815106470d48ad32bbd25e 100644 (file)
@@ -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);
 }