[fedora-virt-maint] rpms/libvirt/devel libvirt-fix-net-hotunplug-double-free.patch, NONE, 1.1 libvirt-fix-pci-hostdev-hotunplug-leak.patch, NONE, 1.1 libvirt-0.6.4-svirt-sound.patch, 1.5, 1.6 libvirt.spec, 1.178, 1.179

Mark McLoughlin markmc at fedoraproject.org
Thu Sep 17 14:47:54 UTC 2009


Author: markmc

Update of /cvs/pkgs/rpms/libvirt/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5711

Modified Files:
	libvirt-0.6.4-svirt-sound.patch libvirt.spec 
Added Files:
	libvirt-fix-net-hotunplug-double-free.patch 
	libvirt-fix-pci-hostdev-hotunplug-leak.patch 
Log Message:
* Thu Sep 17 2009 Mark McLoughlin <markmc at redhat.com> - 0.7.1-4%
- A couple of hot-unplug memory handling fixes (#523960)


libvirt-fix-net-hotunplug-double-free.patch:
 qemu_driver.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- NEW FILE libvirt-fix-net-hotunplug-double-free.patch ---
>From 9b926eb4c485bd81b0b553107dbb037c2188cd23 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 17 Sep 2009 15:31:08 +0100
Subject: [PATCH] Fix net/disk hot-unplug segfault

When we hot-unplug the last device, we're currently double-freeing
the device definition.

Reported by Michal Nowak here:

  https://bugzilla.redhat.com/523960

* src/qemu_driver.c: fix double free

Fedora-patch: libvirt-fix-net-hotunplug-double-free.patch
---
 src/qemu_driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index a65334f..de31581 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -5998,7 +5998,7 @@ try_command:
             /* ignore, harmless */
         }
     } else {
-        VIR_FREE(vm->def->disks[0]);
+        VIR_FREE(vm->def->disks);
         vm->def->ndisks = 0;
     }
     virDomainDiskDefFree(detach);
@@ -6100,7 +6100,7 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
             /* ignore, harmless */
         }
     } else {
-        VIR_FREE(vm->def->nets[0]);
+        VIR_FREE(vm->def->nets);
         vm->def->nnets = 0;
     }
     virDomainNetDefFree(detach);
-- 
1.6.2.5


libvirt-fix-pci-hostdev-hotunplug-leak.patch:
 qemu_driver.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- NEW FILE libvirt-fix-pci-hostdev-hotunplug-leak.patch ---
>From 0538387bbdb426de88b54a8c45153c5644209698 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 17 Sep 2009 15:32:45 +0100
Subject: [PATCH] Fix leak in PCI hostdev hot-unplug

* src/qemu_driver.c: sync the hostdev hot-unplug code with the disk/net
  code.

Fedora-patch: libvirt-fix-pci-hostdev-hotunplug-leak.patch
---
 src/qemu_driver.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index de31581..2ddcdc0 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -6206,14 +6206,20 @@ static int qemudDomainDetachHostPciDevice(virConnectPtr conn,
         pciFreeDevice(conn, pci);
     }
 
-    if (i != --vm->def->nhostdevs)
-        memmove(&vm->def->hostdevs[i],
-                &vm->def->hostdevs[i+1],
-                sizeof(*vm->def->hostdevs) * (vm->def->nhostdevs-i));
-    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs) < 0) {
-        virReportOOMError(conn);
-        ret = -1;
+    if (vm->def->nhostdevs > 1) {
+        memmove(vm->def->hostdevs + i,
+                vm->def->hostdevs + i + 1,
+                sizeof(*vm->def->hostdevs) *
+                (vm->def->nhostdevs - (i + 1)));
+        vm->def->nhostdevs--;
+        if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs) < 0) {
+            /* ignore, harmless */
+        }
+    } else {
+        VIR_FREE(vm->def->hostdevs);
+        vm->def->nhostdevs = 0;
     }
+    virDomainHostdevDefFree(detach);
 
     return ret;
 }
-- 
1.6.2.5


libvirt-0.6.4-svirt-sound.patch:
 qemu_conf.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Index: libvirt-0.6.4-svirt-sound.patch
===================================================================
RCS file: /cvs/pkgs/rpms/libvirt/devel/libvirt-0.6.4-svirt-sound.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- libvirt-0.6.4-svirt-sound.patch	14 Sep 2009 18:30:45 -0000	1.5
+++ libvirt-0.6.4-svirt-sound.patch	17 Sep 2009 14:47:51 -0000	1.6
@@ -1,4 +1,4 @@
-From e2106f6db9beb9f48e9f87f8a1eaba821d1a2296 Mon Sep 17 00:00:00 2001
+From 127a39777e9809053bb98a9082e27c73543ccfa2 Mon Sep 17 00:00:00 2001
 From: Daniel P. Berrange <berrange at redhat.com>
 Date: Mon, 17 Aug 2009 08:32:08 +0100
 Subject: [PATCH] Disable sound cards when running sVirt


Index: libvirt.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libvirt/devel/libvirt.spec,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -p -r1.178 -r1.179
--- libvirt.spec	17 Sep 2009 13:30:50 -0000	1.178
+++ libvirt.spec	17 Sep 2009 14:47:52 -0000	1.179
@@ -151,7 +151,7 @@
 Summary: Library providing a simple API virtualization
 Name: libvirt
 Version: 0.7.1
-Release: 3%{?dist}%{?extra_release}
+Release: 4%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 Source: http://libvirt.org/sources/libvirt-%{version}.tar.gz
@@ -160,6 +160,10 @@ Source: http://libvirt.org/sources/libvi
 # out when SELinux enforcing (bz 486112)
 Patch00: libvirt-0.6.4-svirt-sound.patch
 
+# A couple of hot-unplug memory handling fixes (#523960)
+Patch01: libvirt-fix-net-hotunplug-double-free.patch
+Patch02: libvirt-fix-pci-hostdev-hotunplug-leak.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 URL: http://libvirt.org/
 BuildRequires: python-devel
@@ -373,6 +377,8 @@ of recent versions of Linux (and other O
 %setup -q
 
 %patch00 -p1
+%patch01 -p1
+%patch02 -p1
 
 %build
 %if ! %{with_xen}
@@ -763,6 +769,9 @@ fi
 %endif
 
 %changelog
+* Thu Sep 17 2009 Mark McLoughlin <markmc at redhat.com> - 0.7.1-4%
+- A couple of hot-unplug memory handling fixes (#523960)
+
 * Thu Sep 17 2009 Daniel Veillard <veillard at redhat.com> - 0.7.1-3
 - disable numactl on s390[x]
 




More information about the Fedora-virt-maint mailing list