[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/15] memory: fix segv on qemu_ram_free(block=0x0)
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 03/15] memory: fix segv on qemu_ram_free(block=0x0) |
Date: |
Tue, 5 Apr 2016 11:50:06 +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
memory-backend-file,mem-path=/dev/hugepages.
Program received signal SIGSEGV, Segmentation fault.
0x00005555556e67e7 in qemu_ram_free (block=0x0) at
/home/elmarco/src/qemu/exec.c:1775
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/exec.c b/exec.c
index f46e596..c4f9036 100644
--- a/exec.c
+++ b/exec.c
@@ -1773,6 +1773,10 @@ static void reclaim_ramblock(RAMBlock *block)
void qemu_ram_free(RAMBlock *block)
{
+ if (!block) {
+ return;
+ }
+
qemu_mutex_lock_ramlist();
QLIST_REMOVE_RCU(block, next);
ram_list.mru_block = NULL;
--
2.5.5
- [Qemu-devel] [PULL 00/15] Misc changes for QEMU 2.6.0-rc1, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 04/15] target-i386: do not pass MSR_TSC_AUX to KVM ioctls if CPUID bit is not set, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 02/15] target-i386/kvm: Hyper-V VMBus hypercalls blank handlers, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 03/15] memory: fix segv on qemu_ram_free(block=0x0),
Paolo Bonzini <=
- [Qemu-devel] [PULL 01/15] update Linux headers to 4.6, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 05/15] target-i386: assert that KVM_GET/SET_MSRS can set all requested MSRs, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 09/15] char: ensure all clients are in non-blocking mode, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 08/15] char: fix broken EAGAIN retry on OS-X due to errno clobbering, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 10/15] doc/memory: update MMIO section, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 07/15] util: retry getaddrinfo if getting EAI_BADFLAGS with AI_V4MAPPED, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 11/15] nbd: don't request FUA on FLUSH, Paolo Bonzini, 2016/04/05
- [Qemu-devel] [PULL 06/15] checkpatch: add target_ulong to typelist, Paolo Bonzini, 2016/04/05