]> granicus.if.org Git - zfs/commitdiff
Fix ICP memleak introduced in #4760
authorTom Caputi <tcaputi@datto.com>
Wed, 12 Oct 2016 19:52:30 +0000 (15:52 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 12 Oct 2016 19:52:30 +0000 (12:52 -0700)
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 <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Issue #4760
Closes #5265

module/icp/io/skein_mod.c

index e909a7e31a3d6aa26b0d371ebf7837ff6b355ba3..705b1e819078d2e71444ce971e77231d78e3e5d9 100644 (file)
@@ -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));
 }