Print this page
OS-2910 sdev_node_t can end up associated with wrong sdev_plugin_t


 945         if (dv->sdev_path) {
 946                 kmem_free(dv->sdev_path, strlen(dv->sdev_path) + 1);
 947                 dv->sdev_path = NULL;
 948         }
 949 
 950         if (!SDEV_IS_GLOBAL(dv))
 951                 sdev_prof_free(dv);
 952 
 953         if (SDEVTOV(dv)->v_type == VDIR) {
 954                 ASSERT(SDEV_FIRST_ENTRY(dv) == NULL);
 955                 avl_destroy(&dv->sdev_entries);
 956         }
 957 
 958         mutex_destroy(&dv->sdev_lookup_lock);
 959         cv_destroy(&dv->sdev_lookup_cv);
 960 
 961         /* return node to initial state as per constructor */
 962         (void) memset((void *)&dv->sdev_instance_data, 0,
 963             sizeof (dv->sdev_instance_data));
 964         vn_invalid(SDEVTOV(dv));

 965         kmem_cache_free(sdev_node_cache, dv);
 966 }
 967 
 968 /*
 969  * DIRECTORY CACHE lookup
 970  */
 971 struct sdev_node *
 972 sdev_findbyname(struct sdev_node *ddv, char *nm)
 973 {
 974         struct sdev_node *dv;
 975         struct sdev_node dvtmp;
 976         avl_index_t     where;
 977 
 978         ASSERT(RW_LOCK_HELD(&ddv->sdev_contents));
 979 
 980         dvtmp.sdev_name = nm;
 981         dv = avl_find(&ddv->sdev_entries, &dvtmp, &where);
 982         if (dv) {
 983                 ASSERT(dv->sdev_dotdot == ddv);
 984                 ASSERT(strcmp(dv->sdev_name, nm) == 0);




 945         if (dv->sdev_path) {
 946                 kmem_free(dv->sdev_path, strlen(dv->sdev_path) + 1);
 947                 dv->sdev_path = NULL;
 948         }
 949 
 950         if (!SDEV_IS_GLOBAL(dv))
 951                 sdev_prof_free(dv);
 952 
 953         if (SDEVTOV(dv)->v_type == VDIR) {
 954                 ASSERT(SDEV_FIRST_ENTRY(dv) == NULL);
 955                 avl_destroy(&dv->sdev_entries);
 956         }
 957 
 958         mutex_destroy(&dv->sdev_lookup_lock);
 959         cv_destroy(&dv->sdev_lookup_cv);
 960 
 961         /* return node to initial state as per constructor */
 962         (void) memset((void *)&dv->sdev_instance_data, 0,
 963             sizeof (dv->sdev_instance_data));
 964         vn_invalid(SDEVTOV(dv));
 965         dv->sdev_private = NULL;
 966         kmem_cache_free(sdev_node_cache, dv);
 967 }
 968 
 969 /*
 970  * DIRECTORY CACHE lookup
 971  */
 972 struct sdev_node *
 973 sdev_findbyname(struct sdev_node *ddv, char *nm)
 974 {
 975         struct sdev_node *dv;
 976         struct sdev_node dvtmp;
 977         avl_index_t     where;
 978 
 979         ASSERT(RW_LOCK_HELD(&ddv->sdev_contents));
 980 
 981         dvtmp.sdev_name = nm;
 982         dv = avl_find(&ddv->sdev_entries, &dvtmp, &where);
 983         if (dv) {
 984                 ASSERT(dv->sdev_dotdot == ddv);
 985                 ASSERT(strcmp(dv->sdev_name, nm) == 0);