platform_drv: return quota when freeing dma memory

This is an interim fix for solving the quota leakage problem of
the platform driver on x86 platforms. To properly fix that problem
one has to track which dataspaces where created by the platform driver,
so that freeing the dataspace and reversing the quota transfer is done
on correct dataspaces only.

Refer #1980
This commit is contained in:
Stefan Kalkowski 2016-05-25 11:19:03 +02:00 committed by Christian Helmuth
parent 46a7b2ea66
commit c48e13e1c0

View File

@ -842,8 +842,17 @@ namespace Platform {
void free_dma_buffer(Ram_capability ram)
{
if (ram.valid())
/*
* FIXME: proof that the ram cap come from us,
* otherwise we get bookkeeping errors
*/
if (ram.valid()) {
Genode::size_t size = Genode::Dataspace_client(ram).size();
_resources.ram().free(ram);
if (_resources.ram().transfer_quota(Genode::env()->ram_session_cap(), size))
throw Fatal();
_md_alloc.upgrade(size);
}
}
Device_capability device(String const &name) override;