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 <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
This commit is contained in:
candychencan 2016-10-01 07:04:43 +08:00 committed by Brian Behlendorf
parent 0a8f18f932
commit 0ca5261be4

View 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);