Skip to content

Commit 6a5e658

Browse files
committed
BTL/UCT: check return status from some uct funcs
Without doing this bad results can happen. Detected in testing a UCX 1.17.0rc. Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent 8b4237c commit 6a5e658

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

opal/mca/btl/uct/btl_uct_component.c

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2018 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
18-
* Copyright (c) 2018 Triad National Security, LLC. All rights
18+
* Copyright (c) 2018-2024 Triad National Security, LLC. All rights
1919
* reserved.
2020
* Copyright (c) 2019-2021 Google, LLC. All rights reserved.
2121
* Copyright (c) 2019 Intel, Inc. All rights reserved.
@@ -348,6 +348,7 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc,
348348
bool found = false;
349349
unsigned num_tls;
350350
char *tmp;
351+
ucs_status_t ucs_status;
351352

352353
if (MCA_BTL_UCT_MAX_MODULES == mca_btl_uct_component.module_count) {
353354
BTL_VERBOSE(("created the maximum number of allowable modules"));
@@ -372,16 +373,40 @@ static int mca_btl_uct_component_process_uct_md(uct_md_resource_desc_t *md_desc,
372373
md = OBJ_NEW(mca_btl_uct_md_t);
373374

374375
#if UCT_API >= UCT_VERSION(1, 7)
375-
uct_md_config_read(component, NULL, NULL, &uct_config);
376-
uct_md_open(component, md_desc->md_name, uct_config, &md->uct_md);
376+
ucs_status = uct_md_config_read(component, NULL, NULL, &uct_config);
377+
if (UCS_OK != ucs_status) {
378+
BTL_VERBOSE(("uct_md_config_read failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
379+
return OPAL_ERR_NOT_AVAILABLE;
380+
}
381+
ucs_status = uct_md_open(component, md_desc->md_name, uct_config, &md->uct_md);
382+
if (UCS_OK != ucs_status) {
383+
BTL_VERBOSE(("uct_md_open failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
384+
return OPAL_ERR_NOT_AVAILABLE;
385+
}
377386
#else
378-
uct_md_config_read(md_desc->md_name, NULL, NULL, &uct_config);
379-
uct_md_open(md_desc->md_name, uct_config, &md->uct_md);
387+
ucs_status = uct_md_config_read(md_desc->md_name, NULL, NULL, &uct_config);
388+
if (UCS_OK != ucs_status) {
389+
BTL_VERBOSE(("uct_md_config_read failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
390+
return OPAL_ERR_NOT_AVAILABLE;
391+
}
392+
ucs_status = uct_md_open(md_desc->md_name, uct_config, &md->uct_md);
393+
if (UCS_OK != ucs_status) {
394+
BTL_VERBOSE(("uct_md_open failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
395+
return OPAL_ERR_NOT_AVAILABLE;
396+
}
380397
#endif
381398
uct_config_release(uct_config);
382399

383-
uct_md_query(md->uct_md, &md_attr);
384-
uct_md_query_tl_resources(md->uct_md, &tl_desc, &num_tls);
400+
ucs_status = uct_md_query(md->uct_md, &md_attr);
401+
if (UCS_OK != ucs_status) {
402+
BTL_VERBOSE(("uct_config_release failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
403+
return OPAL_ERR_NOT_AVAILABLE;
404+
}
405+
ucs_status = uct_md_query_tl_resources(md->uct_md, &tl_desc, &num_tls);
406+
if (UCS_OK != ucs_status) {
407+
BTL_VERBOSE(("uct_config_release failed %d (%s)", ucs_status, ucs_status_string(ucs_status)));
408+
return OPAL_ERR_NOT_AVAILABLE;
409+
}
385410

386411
module = mca_btl_uct_alloc_module(md_desc->md_name, md, md_attr.rkey_packed_size);
387412
if (NULL == module) {

0 commit comments

Comments
 (0)