]> granicus.if.org Git - zfs/commitdiff
Fix NULL deref in kcf_remove_mech_provider
authorcandychencan <chen.can2@zte.com.cn>
Fri, 30 Sep 2016 23:04:43 +0000 (07:04 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 30 Sep 2016 23:04:43 +0000 (16:04 -0700)
In the default case the function must return to avoid dereferencing
'prov_mech' which will be NULL.

Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: candychencan <chen.can2@zte.com.cn>
Closes #5134

module/icp/core/kcf_mech_tabs.c

index 3545f03eebf8e372e3d2c11c3d46bab83d12d1df..3ed154758c7fb4f674228222e415f9f217f8da8c 100644 (file)
@@ -659,7 +659,9 @@ kcf_remove_mech_provider(char *mech_name, kcf_provider_desc_t *prov_desc)
                mech_entry->me_sw_prov = NULL;
                break;
        default:
-               break;
+               /* unexpected crypto_provider_type_t */
+               mutex_exit(&mech_entry->me_mutex);
+               return;
        }
 
        mutex_exit(&mech_entry->me_mutex);