[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] memory: fix segv on qemu_ram_free(block=0x0)

From: marcandre . lureau
Subject: [Qemu-devel] [PATCH] memory: fix segv on qemu_ram_free(block=0x0)
Date: Tue, 29 Mar 2016 13:20:51 +0200

From: Marc-André Lureau <address@hidden>

Since f1060c55bf1377b4, the pointer is directly passed to
qemu_ram_free(). However, on initialization failure, it may be called
with a NULL pointer. Return immediately in this case.

This fixes a SEGV when memory initialization failed, for example
permission denied on open backing store /dev/hugepages, with -object

Program received signal SIGSEGV, Segmentation fault.
0x00005555556e67e7 in qemu_ram_free (block=0x0) at 

Signed-off-by: Marc-André Lureau <address@hidden>
 exec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/exec.c b/exec.c
index f398d21..965f3b2 100644
--- a/exec.c
+++ b/exec.c
@@ -1771,6 +1771,10 @@ static void reclaim_ramblock(RAMBlock *block)
 void qemu_ram_free(RAMBlock *block)
+    if (!block) {
+        return;
+    }
     QLIST_REMOVE_RCU(block, next);
     ram_list.mru_block = NULL;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]