summaryrefslogtreecommitdiffstats
path: root/module/icp/io
diff options
context:
space:
mode:
authorTom Caputi <[email protected]>2016-10-12 15:52:30 -0400
committerBrian Behlendorf <[email protected]>2016-10-12 12:52:30 -0700
commitef78750d98f7389b05567c5abe95aacaece91736 (patch)
tree89c32a9eab4e8ce3475a462e18ec6557d5c58695 /module/icp/io
parent06cf4d989058a65f72b140d85e2c21effd3b3834 (diff)
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tom Caputi <[email protected]> Issue #4760 Closes #5265
Diffstat (limited to 'module/icp/io')
-rw-r--r--module/icp/io/skein_mod.c13
1 files changed, 13 insertions, 0 deletions
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));
}