Skip to content

v3.1.x: rcache/grdma: fix crash when part of a registration is unmapped #4664

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

Merged
merged 1 commit into from
Jan 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions opal/mca/rcache/grdma/rcache_grdma_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ static int mca_rcache_grdma_deregister (mca_rcache_base_module_t *rcache,
return OPAL_SUCCESS;
}

rc = dereg_mem (reg);
if (!(reg->flags & MCA_RCACHE_FLAGS_INVALID)) {
/* only call dereg mem if this registration is not in the GC lifo */
rc = dereg_mem (reg);
}

opal_mutex_unlock (&rcache_grdma->cache->vma_module->vma_lock);

return rc;
Expand Down Expand Up @@ -451,7 +455,7 @@ static int gc_add (mca_rcache_base_registration_t *grdma_reg, void *ctx)
/* This may be called from free() so avoid recursively calling into free by just
* shifting this registration into the garbage collection list. The cleanup will
* be done on the next registration attempt. */
if (registration_is_cacheable (grdma_reg)) {
if (registration_is_cacheable (grdma_reg) && !grdma_reg->ref_count) {
opal_list_remove_item (&rcache_grdma->cache->lru_list, (opal_list_item_t *) grdma_reg);
}

Expand Down