mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
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:
parent
46a7b2ea66
commit
c48e13e1c0
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user