701 /*
702 * Check if any other thread is disabling or removing
703 * this provider. We return if this is the case.
704 */
705 if (provider->pd_state >= KCF_PROV_DISABLED) {
706 mutex_exit(&provider->pd_lock);
707 KCF_PROV_REFRELE(provider);
708 return (CRYPTO_BUSY);
709 }
710 provider->pd_state = KCF_PROV_DISABLED;
711 mutex_exit(&provider->pd_lock);
712
713 undo_register_provider(provider, B_TRUE);
714 KCF_PROV_REFRELE(provider);
715 if (provider->pd_kstat != NULL)
716 KCF_PROV_REFRELE(provider);
717
718 /* Wait till the existing requests complete. */
719 while (kcf_get_refcnt(provider, B_TRUE) > 0) {
720 /* wait 1 second and try again. */
721 delay(1 * drv_usectohz(1000000));
722 }
723 }
724
725 if (new_count == 0) {
726 kcf_policy_remove_by_name(name, &prev_count, &prev_array);
727 crypto_free_mech_list(prev_array, prev_count);
728 rv = CRYPTO_SUCCESS;
729 goto out;
730 }
731
732 /* put disabled mechanisms into policy table */
733 if ((rv = kcf_policy_load_soft_disabled(name, new_count, new_array,
734 &prev_count, &prev_array)) == CRYPTO_SUCCESS) {
735 crypto_free_mech_list(prev_array, prev_count);
736 }
737
738 out:
739 if (provider != NULL) {
740 redo_register_provider(provider);
741 if (provider->pd_kstat != NULL)
|
701 /*
702 * Check if any other thread is disabling or removing
703 * this provider. We return if this is the case.
704 */
705 if (provider->pd_state >= KCF_PROV_DISABLED) {
706 mutex_exit(&provider->pd_lock);
707 KCF_PROV_REFRELE(provider);
708 return (CRYPTO_BUSY);
709 }
710 provider->pd_state = KCF_PROV_DISABLED;
711 mutex_exit(&provider->pd_lock);
712
713 undo_register_provider(provider, B_TRUE);
714 KCF_PROV_REFRELE(provider);
715 if (provider->pd_kstat != NULL)
716 KCF_PROV_REFRELE(provider);
717
718 /* Wait till the existing requests complete. */
719 while (kcf_get_refcnt(provider, B_TRUE) > 0) {
720 /* wait 1 second and try again. */
721 delay(drv_sectohz(1));
722 }
723 }
724
725 if (new_count == 0) {
726 kcf_policy_remove_by_name(name, &prev_count, &prev_array);
727 crypto_free_mech_list(prev_array, prev_count);
728 rv = CRYPTO_SUCCESS;
729 goto out;
730 }
731
732 /* put disabled mechanisms into policy table */
733 if ((rv = kcf_policy_load_soft_disabled(name, new_count, new_array,
734 &prev_count, &prev_array)) == CRYPTO_SUCCESS) {
735 crypto_free_mech_list(prev_array, prev_count);
736 }
737
738 out:
739 if (provider != NULL) {
740 redo_register_provider(provider);
741 if (provider->pd_kstat != NULL)
|