qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] fix segfault in setting migration speed


From: Glauber Costa
Subject: [Qemu-devel] [PATCH] fix segfault in setting migration speed
Date: Tue, 14 Jul 2009 18:26:51 -0400

Hi,

Whoever wrote this migrate_set_speed function is totally stupid.

Any failed or completed migration keeps its state to allow probing of
migration data, but has no associated file anymore. It is, thus,
possible to crash qemu by calling migrate_set_speed after a migration
is finished (or failed, or cancelled), but before another one starts.

This patch fixes it.

Signed-off-by: Glauber Costa <address@hidden>
---
 savevm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/savevm.c b/savevm.c
index 17da35a..e577109 100644
--- a/savevm.c
+++ b/savevm.c
@@ -574,7 +574,9 @@ int qemu_file_rate_limit(QEMUFile *f)
 
 size_t qemu_file_set_rate_limit(QEMUFile *f, size_t new_rate)
 {
-    if (f->set_rate_limit)
+    /* any failed or completed migration keeps its state to allow probing of
+     * migration data, but has no associated file anymore */
+    if (f && f->set_rate_limit)
         return f->set_rate_limit(f->opaque, new_rate);
 
     return 0;
-- 
1.6.2.2





reply via email to

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