All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: fix unmatched RAM alloction/free
@ 2013-05-23  1:02 ` Xudong Hao
  0 siblings, 0 replies; 12+ messages in thread
From: Xudong Hao @ 2009-01-17 23:13 UTC (permalink / raw)
  To: kvm; +Cc: gleb, pbonzini, qemu-devel, Xudong Hao

mmap is used in qemu_vmalloc function instead of qemu_memalign(commit
7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched
issue.

This issue appears when a PCI device is being assigned to KVM guest,
failure to read PCI rom file will bring RAM free, then the incorrect
qemu_vfree calling will cause a segment fault.

Signed-off-by: Xudong Hao <xudong.hao@intel.com>
---
 exec.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index fa1e0c3..d40d237 100644
--- a/exec.c
+++ b/exec.c
@@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr)
                 abort();
 #endif
             } else {
-#if defined(TARGET_S390X) && defined(CONFIG_KVM)
-                munmap(block->host, block->length);
-#else
                 if (xen_enabled()) {
                     xen_invalidate_map_cache_entry(block->host);
                 } else {
-                    qemu_vfree(block->host);
+                    munmap(block->host, block->length);
                 }
-#endif
             }
             g_free(block);
             break;
-- 
1.5.6


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-05-29  2:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-17 23:13 [PATCH] qemu-kvm: fix unmatched RAM alloction/free Xudong Hao
2013-05-23  1:02 ` [Qemu-devel] " Xudong Hao
2013-05-23 17:13 ` Paolo Bonzini
2013-05-23 17:13   ` [Qemu-devel] " Paolo Bonzini
2013-05-24  1:21   ` Hao, Xudong
2013-05-24  1:21     ` [Qemu-devel] " Hao, Xudong
2013-05-24 13:08     ` Eric Blake
2013-05-24 13:08       ` Eric Blake
2013-05-28 18:34 ` Michael Tokarev
2013-05-28 18:34   ` [Qemu-devel] " Michael Tokarev
2013-05-29  2:37   ` Hao, Xudong
2013-05-29  2:37     ` [Qemu-devel] " Hao, Xudong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.