Skip to content

Commit

Permalink
prov/verbs_nd: Check error code from GetPrivateData
Browse files Browse the repository at this point in the history
On ECONNREFUSED Mellanox drivers return 0xc000023a while still writing
to `len` a non-zero value. This commit addresses the issue by checking
both the error code and `len` for non-zero values.

Signed-off-by: Kajetan Świerk <[email protected]>
  • Loading branch information
k0zmo authored and j-xiong committed Nov 16, 2023
1 parent abc780b commit da40f10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions prov/verbs/src/windows/verbs_nd_ov.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void nd_get_connection_data(IND2Connector *connector, struct nd_cm_event *event)
FI_LOG_EP_CTRL, "IND2Connector::GetPrivateData: hr=0x%08lx\n",
hr);

event->event.param.conn.private_data_len = (uint8_t)len;
if (len) {
if (SUCCEEDED(hr) && len) {
event->event.param.conn.private_data_len = (uint8_t)len;
event->event.param.conn.private_data = malloc(len);
if (event->event.param.conn.private_data) {
hr = connector->lpVtbl->GetPrivateData(
Expand All @@ -140,13 +140,19 @@ void nd_get_connection_data(IND2Connector *connector, struct nd_cm_event *event)
FI_LOG_EP_CTRL,
"IND2Connector::GetPrivateData: hr=0x%08lx\n",
hr);
if (FAILED(hr)) {
free(event->event.param.conn.private_data);
event->event.param.conn.private_data = NULL;
event->event.param.conn.private_data_len = 0;
}
} else {
event->event.param.conn.private_data_len = 0;
VRB_WARN(
FI_LOG_EP_CTRL,
"Failed to allocate memory for connection data.\n");
}
} else {
event->event.param.conn.private_data_len = 0;
event->event.param.conn.private_data = NULL;
}
}
Expand Down

0 comments on commit da40f10

Please sign in to comment.