module: icp: remove unused me_mutex
It only needs to be locked if dynamic changes can occur. They can't. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12901
This commit is contained in:
parent
cb6e9c3f5f
commit
1cb6fa2cb8
|
@ -107,8 +107,6 @@ kcf_get_mech_provider(crypto_mech_type_t mech_type, kcf_mech_entry_t **mepp,
|
|||
if (mepp != NULL)
|
||||
*mepp = me;
|
||||
|
||||
mutex_enter(&me->me_mutex);
|
||||
|
||||
/* Is there a provider? */
|
||||
if (pd == NULL && (mdesc = me->me_sw_prov) != NULL) {
|
||||
pd = mdesc->pm_prov_desc;
|
||||
|
@ -130,6 +128,5 @@ kcf_get_mech_provider(crypto_mech_type_t mech_type, kcf_mech_entry_t **mepp,
|
|||
} else
|
||||
KCF_PROV_REFHOLD(pd);
|
||||
|
||||
mutex_exit(&me->me_mutex);
|
||||
return (pd);
|
||||
}
|
||||
|
|
|
@ -146,8 +146,6 @@ kcf_destroy_mech_tabs(void)
|
|||
for (class = KCF_FIRST_OPSCLASS; class <= KCF_LAST_OPSCLASS; class++) {
|
||||
max = kcf_mech_tabs_tab[class].met_size;
|
||||
me_tab = kcf_mech_tabs_tab[class].met_tab;
|
||||
for (i = 0; i < max; i++)
|
||||
mutex_destroy(&(me_tab[i].me_mutex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,8 +174,6 @@ kcf_init_mech_tabs(void)
|
|||
int max = kcf_mech_tabs_tab[class].met_size;
|
||||
me_tab = kcf_mech_tabs_tab[class].met_tab;
|
||||
for (int i = 0; i < max; i++) {
|
||||
mutex_init(&(me_tab[i].me_mutex), NULL,
|
||||
MUTEX_DEFAULT, NULL);
|
||||
if (me_tab[i].me_name[0] != 0) {
|
||||
me_tab[i].me_mechid = KCF_MECHID(class, i);
|
||||
(void) mod_hash_insert(kcf_mech_hash,
|
||||
|
@ -242,7 +238,6 @@ kcf_create_mech_entry(kcf_ops_class_t class, const char *mechname)
|
|||
size = kcf_mech_tabs_tab[class].met_size;
|
||||
|
||||
while (i < size) {
|
||||
mutex_enter(&(me_tab[i].me_mutex));
|
||||
if (me_tab[i].me_name[0] == 0) {
|
||||
/* Found an empty spot */
|
||||
(void) strlcpy(me_tab[i].me_name, mechname,
|
||||
|
@ -250,14 +245,12 @@ kcf_create_mech_entry(kcf_ops_class_t class, const char *mechname)
|
|||
me_tab[i].me_name[CRYPTO_MAX_MECH_NAME-1] = '\0';
|
||||
me_tab[i].me_mechid = KCF_MECHID(class, i);
|
||||
|
||||
mutex_exit(&(me_tab[i].me_mutex));
|
||||
/* Add the new mechanism to the hash table */
|
||||
(void) mod_hash_insert(kcf_mech_hash,
|
||||
(mod_hash_key_t)me_tab[i].me_name,
|
||||
(mod_hash_val_t)&(me_tab[i].me_mechid));
|
||||
break;
|
||||
}
|
||||
mutex_exit(&(me_tab[i].me_mutex));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -353,7 +346,6 @@ kcf_add_mech_provider(short mech_indx,
|
|||
* Add new kcf_prov_mech_desc at the front of HW providers
|
||||
* chain.
|
||||
*/
|
||||
mutex_enter(&mech_entry->me_mutex);
|
||||
if (mech_entry->me_sw_prov != NULL) {
|
||||
/*
|
||||
* There is already a provider for this mechanism.
|
||||
|
@ -377,7 +369,6 @@ kcf_add_mech_provider(short mech_indx,
|
|||
*/
|
||||
mech_entry->me_sw_prov = prov_mech;
|
||||
}
|
||||
mutex_exit(&mech_entry->me_mutex);
|
||||
|
||||
*pmdpp = prov_mech;
|
||||
|
||||
|
@ -425,16 +416,13 @@ kcf_remove_mech_provider(const char *mech_name, kcf_provider_desc_t *prov_desc)
|
|||
return;
|
||||
}
|
||||
|
||||
mutex_enter(&mech_entry->me_mutex);
|
||||
if (mech_entry->me_sw_prov == NULL ||
|
||||
mech_entry->me_sw_prov->pm_prov_desc != prov_desc) {
|
||||
/* not the provider for this mechanism */
|
||||
mutex_exit(&mech_entry->me_mutex);
|
||||
return;
|
||||
}
|
||||
prov_mech = mech_entry->me_sw_prov;
|
||||
mech_entry->me_sw_prov = NULL;
|
||||
mutex_exit(&mech_entry->me_mutex);
|
||||
|
||||
/* free entry */
|
||||
KCF_PROV_REFRELE(prov_mech->pm_prov_desc);
|
||||
|
|
|
@ -290,24 +290,17 @@ kcf_get_sw_prov(crypto_mech_type_t mech_type, kcf_provider_desc_t **pd,
|
|||
if (kcf_get_mech_entry(mech_type, &me) != KCF_SUCCESS)
|
||||
return (CRYPTO_MECHANISM_INVALID);
|
||||
|
||||
/*
|
||||
* Get the provider for this mechanism.
|
||||
* Lock the mech_entry until we grab the 'pd'.
|
||||
*/
|
||||
mutex_enter(&me->me_mutex);
|
||||
|
||||
/* Get the provider for this mechanism. */
|
||||
if (me->me_sw_prov == NULL ||
|
||||
(*pd = me->me_sw_prov->pm_prov_desc) == NULL) {
|
||||
/* no provider for this mechanism */
|
||||
if (log_warn)
|
||||
cmn_err(CE_WARN, "no provider for \"%s\"\n",
|
||||
me->me_name);
|
||||
mutex_exit(&me->me_mutex);
|
||||
return (CRYPTO_MECH_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
KCF_PROV_REFHOLD(*pd);
|
||||
mutex_exit(&me->me_mutex);
|
||||
|
||||
if (mep != NULL)
|
||||
*mep = me;
|
||||
|
|
|
@ -244,7 +244,6 @@ typedef struct kcf_prov_mech_desc {
|
|||
typedef struct kcf_mech_entry {
|
||||
crypto_mech_name_t me_name; /* mechanism name */
|
||||
crypto_mech_type_t me_mechid; /* Internal id for mechanism */
|
||||
kmutex_t me_mutex; /* access protection */
|
||||
kcf_prov_mech_desc_t *me_sw_prov; /* provider */
|
||||
} kcf_mech_entry_t;
|
||||
|
||||
|
|
Loading…
Reference in New Issue