Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prov/rxd: fixed incorrect memory access (after free) #1

Merged
merged 1 commit into from Jun 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions prov/rxd/src/rxd_ep.c
Expand Up @@ -1612,6 +1612,10 @@ int rxd_endpoint(struct fid_domain *domain, struct fi_info *info,
if (!rxd_ep)
return -FI_ENOMEM;

memset(&cq_attr, 0, sizeof cq_attr);
cq_attr.format = FI_CQ_FORMAT_MSG;
cq_attr.wait_obj = FI_WAIT_FD;

rxd_domain = container_of(domain, struct rxd_domain, util_domain.domain_fid);
ret = ofi_endpoint_init(domain, &rxd_util_prov, info, &rxd_ep->util_ep,
context, rxd_ep_progress);
Expand All @@ -1627,14 +1631,11 @@ int rxd_endpoint(struct fid_domain *domain, struct fi_info *info,
rxd_ep->do_local_mr = (rxd_domain->mr_mode & FI_MR_LOCAL) ? 1 : 0;

ret = fi_endpoint(rxd_domain->dg_domain, dg_info, &rxd_ep->dg_ep, rxd_ep);
cq_attr.size = dg_info->tx_attr->size + dg_info->rx_attr->size;
fi_freeinfo(dg_info);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is free

if (ret)
goto err2;

memset(&cq_attr, 0, sizeof cq_attr);
cq_attr.format = FI_CQ_FORMAT_MSG;
cq_attr.size = dg_info->tx_attr->size + dg_info->rx_attr->size;
Copy link
Author

@hoopoepg hoopoepg Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here - access to freed memory

cq_attr.wait_obj = FI_WAIT_FD;
ret = fi_cq_open(rxd_domain->dg_domain, &cq_attr, &rxd_ep->dg_cq, rxd_ep);
if (ret)
goto err3;
Expand Down