Skip to content

Commit aa9d2e5

Browse files
authored
Fix dynamic mapping ownership on unmap failure (#1675)
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 2b393cd commit aa9d2e5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • src/hyperlight_host/src/hypervisor/hyperlight_vm

src/hyperlight_host/src/hypervisor/hyperlight_vm/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,10 @@ impl HyperlightVm {
509509
.position(|(_, r)| r == region)
510510
.ok_or(UnmapRegionError::RegionNotFound)?;
511511

512-
let (slot, _) = self.mmap_regions.remove(pos);
513-
self.freed_slots.push(slot);
512+
let slot = self.mmap_regions[pos].0;
514513
self.vm.unmap_memory((slot, region))?;
514+
self.mmap_regions.remove(pos);
515+
self.freed_slots.push(slot);
515516
Ok(())
516517
}
517518

0 commit comments

Comments
 (0)