From 0ca5261be44abd9f6587792df1dc0c8ff73d2f7c Mon Sep 17 00:00:00 2001 From: candychencan Date: Sat, 1 Oct 2016 07:04:43 +0800 Subject: Fix NULL deref in kcf_remove_mech_provider In the default case the function must return to avoid dereferencing 'prov_mech' which will be NULL. Reviewed-by: Tom Caputi Reviewed-by: Richard Laager Reviewed-by: Brian Behlendorf Signed-off-by: candychencan Closes #5134 --- module/icp/core/kcf_mech_tabs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/icp/core/kcf_mech_tabs.c b/module/icp/core/kcf_mech_tabs.c index 3545f03ee..3ed154758 100644 --- a/module/icp/core/kcf_mech_tabs.c +++ b/module/icp/core/kcf_mech_tabs.c @@ -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); -- cgit v1.2.3