qemu-stable
[Top][All Lists]
Advanced

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

[Qemu-stable] [PATCH 23/23] savevm: fix potential segfault on invalid st


From: Michael S. Tsirkin
Subject: [Qemu-stable] [PATCH 23/23] savevm: fix potential segfault on invalid state
Date: Tue, 3 Dec 2013 18:29:26 +0200

savevm will segfault if version_id < vmsd->minimum_version_id &&
version_id >= vmsd->minimum_version_id_old

This calls through a NULL pointer.  This is a bug (should
exit not crash).

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 savevm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/savevm.c b/savevm.c
index 3f912dd..04349f6 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1686,6 +1686,9 @@ int vmstate_load_state(QEMUFile *f, const 
VMStateDescription *vmsd,
         return -EINVAL;
     }
     if  (version_id < vmsd->minimum_version_id) {
+        if (!vmsd->load_state_old) {
+            return -EINVAL;
+        }
         return vmsd->load_state_old(f, opaque, version_id);
     }
     if (vmsd->pre_load) {
-- 
MST




reply via email to

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