core: handle out-of-memory in RM service

This patch adds the missing exception handling for depleted RM session
quotas. If core runs out of session quota while creating a new region
map, it now reflects this condition as a Region_map::Out_of_metadata
exception to the RM client. Thanks to Denis Huber for reporting the
issue!
This commit is contained in:
Norman Feske 2016-08-25 16:55:12 +02:00 committed by Christian Helmuth
parent dc26910fc3
commit fac69eff48
1 changed files with 8 additions and 5 deletions

View File

@ -77,13 +77,16 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
{
Lock::Guard guard(_region_maps_lock);
Region_map_component *rm =
new (_md_alloc)
Region_map_component(_ep, _md_alloc, _pager_ep, 0, size);
try {
Region_map_component *rm =
new (_md_alloc)
Region_map_component(_ep, _md_alloc, _pager_ep, 0, size);
_region_maps.insert(rm);
_region_maps.insert(rm);
return rm->cap();
return rm->cap();
}
catch (Allocator::Out_of_memory) { throw Out_of_metadata(); }
}
void destroy(Capability<Region_map> rm) override