From ef78750d98f7389b05567c5abe95aacaece91736 Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Wed, 12 Oct 2016 15:52:30 -0400 Subject: [PATCH] Fix ICP memleak introduced in #4760 The ICP requires destructors to for each crypto module that is added. These do not necessarily exist in Illumos because they assume that these modules can never be unloaded from the kernel. Some of this cleanup code was missed when #4760 was merged, resulting in leaks. This patch simply fixes that. Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Signed-off-by: Tom Caputi Issue #4760 Closes #5265 --- module/icp/io/skein_mod.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/module/icp/io/skein_mod.c b/module/icp/io/skein_mod.c index e909a7e31..705b1e819 100644 --- a/module/icp/io/skein_mod.c +++ b/module/icp/io/skein_mod.c @@ -231,6 +231,19 @@ skein_mod_init(void) int skein_mod_fini(void) { + int ret; + + if (skein_prov_handle != 0) { + if ((ret = crypto_unregister_provider(skein_prov_handle)) != + CRYPTO_SUCCESS) { + cmn_err(CE_WARN, + "skein _fini: crypto_unregister_provider() " + "failed (0x%x)", ret); + return (EBUSY); + } + skein_prov_handle = 0; + } + return (mod_remove(&modlinkage)); }