[libvirt] [PATCH] qemuDomainDetachDeviceConfig: Don't free device from @dev

Michal Privoznik posted 1 patch 5 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/25a36b1244d6e536235d32f130ead75b5a6c034b.1529072434.git.mprivozn@redhat.com
Test syntax-check passed
src/qemu/qemu_driver.c | 2 --
1 file changed, 2 deletions(-)
[libvirt] [PATCH] qemuDomainDetachDeviceConfig: Don't free device from @dev
Posted by Michal Privoznik 5 years, 10 months ago
https://bugzilla.redhat.com/show_bug.cgi?id=1591561

For reasons I don't understand my original patch of 75f0fd51124
freed not only the chardev from domain but also the one from
passed virDomainDeviceDefPtr. This caused no troubles until now,
because those two pointers were separate, but after I've
introduced virDomainDetachDeviceAlias() they became the same
resulting in double free on detach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_driver.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 42069ee617..7fe86d4d2e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8241,8 +8241,6 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef,
             return -1;
 
         virDomainChrDefFree(chr);
-        virDomainChrDefFree(dev->data.chr);
-        dev->data.chr = NULL;
         break;
 
     case VIR_DOMAIN_DEVICE_FS:
-- 
2.16.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemuDomainDetachDeviceConfig: Don't free device from @dev
Posted by Ján Tomko 5 years, 10 months ago
On Fri, Jun 15, 2018 at 04:20:41PM +0200, Michal Privoznik wrote:
>https://bugzilla.redhat.com/show_bug.cgi?id=1591561
>
>For reasons I don't understand my original patch of 75f0fd51124
>freed not only the chardev from domain but also the one from
>passed virDomainDeviceDefPtr. This caused no troubles until now,
>because those two pointers were separate, but after I've
>introduced virDomainDetachDeviceAlias() they became the same
>resulting in double free on detach.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_driver.c | 2 --
> 1 file changed, 2 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