Skip to content

Commit

Permalink
Merge pull request #1547 from RDMA-Rust/fix/rdmacm-addr-resolved
Browse files Browse the repository at this point in the history
librdmacm: prevent NULL pointer access during device initialization
  • Loading branch information
yishaih authored Feb 4, 2025
2 parents 1d0a034 + 56da3c2 commit aac4923
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions librdmacm/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2252,17 +2252,30 @@ int rdma_ack_cm_event(struct rdma_cm_event *event)

static void ucma_process_addr_resolved(struct cma_event *evt)
{
struct rdma_cm_id *id = &evt->id_priv->id;

if (af_ib_support) {
evt->event.status = ucma_query_addr(&evt->id_priv->id);
evt->event.status = ucma_query_addr(id);
if (!evt->event.status && !id->verbs)
goto err_dev;

if (!evt->event.status &&
evt->id_priv->id.verbs->device->transport_type == IBV_TRANSPORT_IB)
evt->event.status = ucma_query_gid(&evt->id_priv->id);
id->verbs->device->transport_type == IBV_TRANSPORT_IB) {
evt->event.status = ucma_query_gid(id);
}
} else {
evt->event.status = ucma_query_route(&evt->id_priv->id);
evt->event.status = ucma_query_route(id);
if (!evt->event.status && !id->verbs)
goto err_dev;
}

if (evt->event.status)
evt->event.event = RDMA_CM_EVENT_ADDR_ERROR;
return;

err_dev:
evt->event.status = ERR(ENODEV);
evt->event.event = RDMA_CM_EVENT_ADDR_ERROR;
}

static void ucma_process_route_resolved(struct cma_event *evt)
Expand Down

0 comments on commit aac4923

Please sign in to comment.