[libvirt] [PATCH v2 05/12] qemuDomainDetachShmemDevice: Don't release shmem address twice

Michal Privoznik posted 12 patches 6 years, 11 months ago
[libvirt] [PATCH v2 05/12] qemuDomainDetachShmemDevice: Don't release shmem address twice
Posted by Michal Privoznik 6 years, 11 months ago
On shmem unplug, when qemu doesn't support DEVICE_DELETED event
(or couple of other reasons) we do two things:

1) release shmem device address,
2) call qemuDomainRemoveShmemDevice() which does 1) again.

This is potentially dangerous.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_hotplug.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index cddd700af8..dba4bc9a6e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5291,10 +5291,8 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
         ret = -1;
 
     if (ret == 0) {
-        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1) {
-            qemuDomainReleaseDeviceAddress(vm, &shmem->info, NULL);
+        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
             ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
-        }
     }
     qemuDomainResetDeviceRemoval(vm);
 
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 05/12] qemuDomainDetachShmemDevice: Don't release shmem address twice
Posted by Ján Tomko 6 years, 11 months ago
On Thu, May 24, 2018 at 01:13:32PM +0200, Michal Privoznik wrote:
>On shmem unplug, when qemu doesn't support DEVICE_DELETED event
>(or couple of other reasons) we do two things:
>
>1) release shmem device address,
>2) call qemuDomainRemoveShmemDevice() which does 1) again.
>
>This is potentially dangerous.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_hotplug.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list