crypto: scomp - Fix memory leak on module unload
Herbert Xu
maintainercover crypto: scomp - Fix memory leak on module unload
This mini series fixes the leaking of stream memory when an scomp algorith module is unloaded.
Herbert Xu (2):
crypto: scompress - Fix incorrect stream freeing
crypto: api - Call crypto_alg_put in crypto_unregister_alg
crypto/algapi.c | 3 +-- crypto/scompress.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.5
Herbert Xu
maintainerPATCH 1/2 crypto: scompress - Fix incorrect stream freeing
Fix stream freeing crash by passing the correct pointer.
Fixes 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
Signed-off-by Herbert Xu <[email protected]>
--- crypto/scompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/scompress.c +1 -1
@@ -117,7 +117,7 @@ static void scomp_free_streams(struct scomp_alg *alg)if (!ps->ctx)break ; - alg->free_ctx (ps); + alg->free_ctx (ps->ctx); }free_percpu (stream);
Signature · 1 line
2.39.5
Herbert Xu
maintainerPATCH 2/2 crypto: api - Call crypto_alg_put in crypto_unregister_alg
In reply to Herbert XuInstead 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 <[email protected]>
--- crypto/algapi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
crypto/algapi.c +1 -2
@@ -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); }
Signature · 1 line
2.39.5