qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [COMMIT 0bb05ea] fix segfault in setting migration speed


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 0bb05ea] fix segfault in setting migration speed
Date: Thu, 16 Jul 2009 23:12:47 -0000

From: Glauber Costa <address@hidden>

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>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/savevm.c b/savevm.c
index 113f220..181c088 100644
--- a/savevm.c
+++ b/savevm.c
@@ -556,7 +556,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;




reply via email to

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