127bba
From c70aca8e3aa358b5451d5b0d45bf6802ceb9ad94 Mon Sep 17 00:00:00 2001
127bba
Message-Id: <c70aca8e3aa358b5451d5b0d45bf6802ceb9ad94@dist-git>
127bba
From: Martin Kletzander <mkletzan@redhat.com>
127bba
Date: Thu, 10 Nov 2016 10:16:58 +0100
127bba
Subject: [PATCH] qemu: Fix double free when live-attaching shmem
127bba
127bba
https://bugzilla.redhat.com/show_bug.cgi?id=1392031
127bba
127bba
Function qemuDomainAttachShmemDevice() steals the device data if the
127bba
hotplug was successful, but the condition checked for unsuccessful
127bba
execution otherwise.
127bba
127bba
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
127bba
(cherry picked from commit cca34e38fd32dbafa2c647f41a7dfb30d1e2e0a9)
127bba
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
127bba
---
127bba
 src/qemu/qemu_driver.c | 2 +-
127bba
 1 file changed, 1 insertion(+), 1 deletion(-)
127bba
127bba
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
127bba
index 9b4d54b..1e02a7f 100644
127bba
--- a/src/qemu/qemu_driver.c
127bba
+++ b/src/qemu/qemu_driver.c
127bba
@@ -7522,7 +7522,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
127bba
     case VIR_DOMAIN_DEVICE_SHMEM:
127bba
         ret = qemuDomainAttachShmemDevice(driver, vm,
127bba
                                           dev->data.shmem);
127bba
-        if (ret < 0) {
127bba
+        if (!ret) {
127bba
             alias = dev->data.shmem->info.alias;
127bba
             dev->data.shmem = NULL;
127bba
         }
127bba
-- 
127bba
2.10.2
127bba