opensm/osm_pkey_mgr.c: fix segfault when trying to access not allocated block
PATCH 1/4 opensm/osm_pkey_mgr.c: fix segfault when trying to access not allocated block
If the program decides to add a pkey to block 1. It might not allocate memory for block 0. As a result, when the program searches for a pkey, it might try access a not allocated block.
--- opensm/osm_pkey_mgr.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
opensm/osm_pkey_mgr.c +3 -0
@@ -556,6 +556,9 @@ static int new_pkey_exists(osm_pkey_tbs_t * p_pkey_tbl, ib_net16_t pkey) num_blocks = (uint16_t )cl_ptr_vector_get_size (&p_pkey_tbl->new_blocks);for (block_index =0 ; block_index < num_blocks; block_index++) { block =osm_pkey_tbl_new_block_get (p_pkey_tbl, block_index); +if (!block) +continue ; +for (pkey_idx =0 ; pkey_idx <IB_NUM_PKEY_ELEMENTS_IN_BLOCK ; pkey_idx++) {if (block->pkey_entry[pkey_idx] == pkey)
Signature · 7 lines
1.7.7.6 -- Alex -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html