ompi/mca/btl/openib: Fix memory leak and accessing free'd memory issues
Let imagine that we have two btls in btl_openib_component_init() both points to the same openib_btl->device and as a result have the same openib_btl->device->endpoints array. Finalization phase calls twice mca_btl_openib_finalize()->mca_btl_openib_finalize_resources(). mca_btl_openib_finalize_resources() frees endpoint related btl. But the second call of mca_btl_openib_finalize_resources() checks endpoint that is released by previus call. fixed by Igor, reviewed by miked/vasily cmr=v1.7.4:reviewer=ompi-gk1.7 This commit was SVN r29563.
Этот коммит содержится в:
родитель
2e772ef024
Коммит
b0e64427a9
@ -1437,6 +1437,9 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl)
|
|||||||
OBJ_RELEASE(endpoint);
|
OBJ_RELEASE(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
opal_pointer_array_set_item(openib_btl->device->endpoints,
|
||||||
|
ep_index, NULL);
|
||||||
|
assert(((opal_object_t*)endpoint)->obj_reference_count == 1);
|
||||||
OBJ_RELEASE(endpoint);
|
OBJ_RELEASE(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1511,14 +1514,13 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( OMPI_SUCCESS != (rc = mca_btl_openib_finalize_resources(btl) ) ) {
|
|
||||||
BTL_VERBOSE(("Failed to finalize resources"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove the btl from component list */
|
/* Remove the btl from component list */
|
||||||
if ( mca_btl_openib_component.ib_num_btls > 1 ) {
|
if ( mca_btl_openib_component.ib_num_btls > 0 ) {
|
||||||
for(i = 0; i < mca_btl_openib_component.ib_num_btls; i++){
|
for(i = 0; i < mca_btl_openib_component.ib_num_btls; i++){
|
||||||
if (mca_btl_openib_component.openib_btls[i] == openib_btl){
|
if (mca_btl_openib_component.openib_btls[i] == openib_btl){
|
||||||
|
if( OMPI_SUCCESS != (rc = mca_btl_openib_finalize_resources(btl) ) ) {
|
||||||
|
BTL_VERBOSE(("Failed to finalize resources"));
|
||||||
|
}
|
||||||
mca_btl_openib_component.openib_btls[i] =
|
mca_btl_openib_component.openib_btls[i] =
|
||||||
mca_btl_openib_component.openib_btls[mca_btl_openib_component.ib_num_btls-1];
|
mca_btl_openib_component.openib_btls[mca_btl_openib_component.ib_num_btls-1];
|
||||||
break;
|
break;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user