[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 5/7] exec: make sure that RAMBlock descriptor won
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v4 5/7] exec: make sure that RAMBlock descriptor won't be leaked |
Date: |
Thu, 9 Jul 2015 13:47:22 +0200 |
HVA remapped file backed RAMBlock shouldn't be freed
with munmap() as it will create a hole in HVA area
but file descriptor should be freed so it won't leak.
Rearrange code so that file descriptor is freed always
if it's been used and drop unnecessary munmap()
call/branch because qemu_anon_ram_free() is doing the same.
Signed-off-by: Igor Mammedov <address@hidden>
---
exec.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/exec.c b/exec.c
index 562dae5..08767ab 100644
--- a/exec.c
+++ b/exec.c
@@ -1612,14 +1612,14 @@ static void reclaim_ramblock(RAMBlock *block)
;
} else if (xen_enabled()) {
xen_invalidate_map_cache_entry(block->host);
-#ifndef _WIN32
- } else if (block->fd >= 0) {
- munmap(block->host, block->max_length);
- close(block->fd);
-#endif
} else {
qemu_anon_ram_free(block->host, block->max_length);
}
+#ifndef _WIN32
+ if (block->fd >= 0) {
+ close(block->fd);
+ }
+#endif
g_free(block);
}
--
1.8.3.1
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, (continued)
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Michael S. Tsirkin, 2015/07/09
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Igor Mammedov, 2015/07/10
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Michael S. Tsirkin, 2015/07/13
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Igor Mammedov, 2015/07/13
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Michael S. Tsirkin, 2015/07/13
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Igor Mammedov, 2015/07/14
- Re: [Qemu-devel] [PATCH v4 4/7] pc: fix QEMU crashing when more than ~50 memory hotplugged, Michael S. Tsirkin, 2015/07/14
[Qemu-devel] [PATCH v4 3/7] pc: reserve hotpluggable memory range with memory_region_init_hva_range(), Igor Mammedov, 2015/07/09
[Qemu-devel] [PATCH v4 6/7] exec: add qemu_ram_unmap_hva() API for unmapping memory from HVA area, Igor Mammedov, 2015/07/09
[Qemu-devel] [PATCH v4 2/7] memory: introduce MemoryRegion container with reserved HVA range, Igor Mammedov, 2015/07/09
[Qemu-devel] [PATCH v4 5/7] exec: make sure that RAMBlock descriptor won't be leaked,
Igor Mammedov <=
[Qemu-devel] [PATCH v4 1/7] memory: get rid of memory_region_destructor_ram_from_ptr(), Igor Mammedov, 2015/07/09
[Qemu-devel] [PATCH v4 7/7] memory: add support for deleting HVA mapped MemoryRegion, Igor Mammedov, 2015/07/09
Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Igor Mammedov, 2015/07/15
- Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Michael S. Tsirkin, 2015/07/15
- Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Igor Mammedov, 2015/07/16
- Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Michael S. Tsirkin, 2015/07/16
- Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Igor Mammedov, 2015/07/16
- Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Michael S. Tsirkin, 2015/07/16
- Re: [Qemu-devel] [PATCH v4 0/7] Fix QEMU crash during memory hotplug with vhost=on, Igor Mammedov, 2015/07/16