[libvirt] [PATCH] qemu: Fix starting a domain with corrupted managed save file

Jiri Denemark posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/c31e2c0033164a34e10774f22b7dab4a80e6b7f7.1497353570.git.jdenemar@redhat.com
src/qemu/qemu_driver.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
[libvirt] [PATCH] qemu: Fix starting a domain with corrupted managed save file
Posted by Jiri Denemark 6 years, 10 months ago
Commit v3.4.0-44-gac793bd71 fixed a memory leak, but failed to return
the special -3 value. Thus an attempt to start a domain with corrupted
managed save file would removed the corrupted file and report
"An error occurred, but the cause is unknown" instead of starting the
domain from scratch.

https://bugzilla.redhat.com/show_bug.cgi?id=1460962
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_driver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6654fd3e2..ba1dba5b7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6450,17 +6450,15 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
     *ret_def = def;
     *ret_data = data;
 
+ cleanup:
     virObjectUnref(caps);
-
     return fd;
 
  error:
     virDomainDefFree(def);
     virQEMUSaveDataFree(data);
     VIR_FORCE_CLOSE(fd);
-    virObjectUnref(caps);
-
-    return -1;
+    goto cleanup;
 }
 
 static int ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6)
-- 
2.13.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Fix starting a domain with corrupted managed save file
Posted by Martin Kletzander 6 years, 10 months ago
On Tue, Jun 13, 2017 at 01:32:50PM +0200, Jiri Denemark wrote:
>Commit v3.4.0-44-gac793bd71 fixed a memory leak, but failed to return
>the special -3 value. Thus an attempt to start a domain with corrupted
>managed save file would removed the corrupted file and report
>"An error occurred, but the cause is unknown" instead of starting the
>domain from scratch.
>
>https://bugzilla.redhat.com/show_bug.cgi?id=1460962
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/qemu/qemu_driver.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>

ACK

>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index 6654fd3e2..ba1dba5b7 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -6450,17 +6450,15 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
>     *ret_def = def;
>     *ret_data = data;
>
>+ cleanup:
>     virObjectUnref(caps);
>-
>     return fd;
>
>  error:
>     virDomainDefFree(def);
>     virQEMUSaveDataFree(data);
>     VIR_FORCE_CLOSE(fd);
>-    virObjectUnref(caps);
>-
>-    return -1;
>+    goto cleanup;
> }
>
> static int ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6)
>--
>2.13.1
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list