core, region map: handle failing metadata assign

In Region_map_component::attach, storing the metadata for a region may
throw an exception. Catch it and throw an Invalid_dataspace exception.

Ref #2490
This commit is contained in:
Martin Stein 2017-08-16 17:58:18 +02:00 committed by Christian Helmuth
parent b2624be2ad
commit 64377f4b80
1 changed files with 9 additions and 1 deletions

View File

@ -411,7 +411,15 @@ Region_map_component::attach(Dataspace_capability ds_cap, size_t size,
}
/* store attachment info in meta data */
_map.metadata(attach_at, Rm_region((addr_t)attach_at, size, true, dsc, offset, this));
try {
_map.metadata(attach_at, Rm_region((addr_t)attach_at, size, true,
dsc, offset, this));
} catch (Allocator_avl_tpl<Rm_region>::Assign_metadata_failed) {
error("failed to store attachment info");
throw Invalid_dataspace();
}
Rm_region *region = _map.metadata(attach_at);
/* inform dataspace about attachment */