From 1a23a47a6f5faae68ee8e840653a796f08f46182 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Mon, 13 Feb 2012 08:40:43 -0800 Subject: [PATCH] BGQ - handle case of using bad pointers and bitmaps when dealing with sub-allocation steps of sub-block jobs. --- src/plugins/select/bluegene/ba_bgq/block_allocator.c | 7 ++++--- src/plugins/select/bluegene/bg_job_place.c | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/select/bluegene/ba_bgq/block_allocator.c b/src/plugins/select/bluegene/ba_bgq/block_allocator.c index 9cf2bc5d718..dee8ef1dd02 100644 --- a/src/plugins/select/bluegene/ba_bgq/block_allocator.c +++ b/src/plugins/select/bluegene/ba_bgq/block_allocator.c @@ -995,9 +995,10 @@ try_again: return false; } - - FREE_NULL_BITMAP(jobinfo->units_avail); - FREE_NULL_BITMAP(jobinfo->units_used); + if (jobinfo->units_avail) + FREE_NULL_BITMAP(jobinfo->units_avail); + if (jobinfo->units_used) + FREE_NULL_BITMAP(jobinfo->units_used); jobinfo->units_avail = found_bits; found_bits = NULL; diff --git a/src/plugins/select/bluegene/bg_job_place.c b/src/plugins/select/bluegene/bg_job_place.c index 61273e3ea90..4bd0fbeb5fa 100644 --- a/src/plugins/select/bluegene/bg_job_place.c +++ b/src/plugins/select/bluegene/bg_job_place.c @@ -560,7 +560,8 @@ static bg_record_t *_find_matching_block(List block_list, need_free = true; } else total_bitmap = ba_mp->cnode_bitmap; - memcpy(&tmp_jobinfo, jobinfo, sizeof(select_jobinfo_t)); + memset(&tmp_jobinfo, 0, sizeof(select_jobinfo_t)); + tmp_jobinfo.cnode_cnt = jobinfo->cnode_cnt; if (!ba_sub_block_in_bitmap( &tmp_jobinfo, total_bitmap, 0)) { if (need_free) @@ -583,11 +584,17 @@ static bg_record_t *_find_matching_block(List block_list, jobinfo->cnode_cnt = tmp_jobinfo.cnode_cnt; jobinfo->dim_cnt = tmp_jobinfo.dim_cnt; + if (jobinfo->units_avail) + FREE_NULL_BITMAP(jobinfo->units_avail); jobinfo->units_avail = tmp_jobinfo.units_avail; tmp_jobinfo.units_avail = NULL; + + if (jobinfo->units_used) + FREE_NULL_BITMAP(jobinfo->units_used); jobinfo->units_used = tmp_jobinfo.units_used; tmp_jobinfo.units_used = NULL; + xfree(jobinfo->ionode_str); jobinfo->ionode_str = tmp_jobinfo.ionode_str; tmp_jobinfo.ionode_str = NULL; -- GitLab