From 90dddf3d3d4bc3ede8ab5b047c0db1487cd6d89b Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Oct 09 2009 14:53:48 +0000 Subject: * Fri Oct 9 2009 Mark McLoughlin - 0.7.1-11 - Fix libvirtd memory leak during error reply sending (#528162) - Add several PCI hot-unplug typo fixes from upstream --- diff --git a/libvirt-fix-device-detach-typo1.patch b/libvirt-fix-device-detach-typo1.patch new file mode 100644 index 0000000..81315ac --- /dev/null +++ b/libvirt-fix-device-detach-typo1.patch @@ -0,0 +1,29 @@ +From 58c38896a67c170063401d8091bae7dca8842923 Mon Sep 17 00:00:00 2001 +From: Jiri Denemark +Date: Wed, 23 Sep 2009 18:46:23 +0200 +Subject: [PATCH] Fix a typo in virDiskHasValidPciAddr() + +(cherry-picked from commit 3620e3cdcfe56cc4475b5ef1a0a893757240b795) + +Signed-off-by: Jiri Denemark +Fedora-patch: libvirt-fix-device-detach-typo1.patch +--- + src/domain_conf.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/domain_conf.h b/src/domain_conf.h +index 09368d9..d494e54 100644 +--- a/src/domain_conf.h ++++ b/src/domain_conf.h +@@ -125,7 +125,7 @@ struct _virDomainDiskDef { + static inline int + virDiskHasValidPciAddr(virDomainDiskDefPtr def) + { +- return def->pci_addr.domain || def->pci_addr.domain || def->pci_addr.slot; ++ return def->pci_addr.domain || def->pci_addr.bus || def->pci_addr.slot; + } + + +-- +1.6.2.5 + diff --git a/libvirt-fix-device-detach-typo2.patch b/libvirt-fix-device-detach-typo2.patch new file mode 100644 index 0000000..0d17d6b --- /dev/null +++ b/libvirt-fix-device-detach-typo2.patch @@ -0,0 +1,30 @@ +From 81e967c716ce8c085be8baad9169f7772452d187 Mon Sep 17 00:00:00 2001 +From: Mark McLoughlin +Date: Thu, 24 Sep 2009 08:55:55 +0100 +Subject: [PATCH] Fix a typo in virNetHasValidPciAddr() too + +* src/domain_conf.h: check domain/bus/slot, not domain/domain/slot + +(cherry-picked from commit 6bfffce91635bb08de601747e94ed1182c0f47eb) + +Fedora-patch: libvirt-fix-device-detach-typo2.patch +--- + src/domain_conf.h | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/domain_conf.h b/src/domain_conf.h +index d494e54..7c918a7 100644 +--- a/src/domain_conf.h ++++ b/src/domain_conf.h +@@ -207,7 +207,7 @@ struct _virDomainNetDef { + static inline int + virNetHasValidPciAddr(virDomainNetDefPtr def) + { +- return def->pci_addr.domain || def->pci_addr.domain || def->pci_addr.slot; ++ return def->pci_addr.domain || def->pci_addr.bus || def->pci_addr.slot; + } + + enum virDomainChrSrcType { +-- +1.6.2.5 + diff --git a/libvirt-fix-device-detach-typo3.patch b/libvirt-fix-device-detach-typo3.patch new file mode 100644 index 0000000..4a69e80 --- /dev/null +++ b/libvirt-fix-device-detach-typo3.patch @@ -0,0 +1,30 @@ +From 3a64779ec5a89d38d64e07bca2b11b19e1882d7a Mon Sep 17 00:00:00 2001 +From: Charles Duffy +Date: Thu, 24 Sep 2009 09:00:24 +0100 +Subject: [PATCH] Fix unitialized variable in qemudDomainDetachHostPciDevice() + +* src/qemu_driver.c: initialize detach var + +(cherry-picked from commit 580ad29288751234bee47ac9f6c04dac1dc529ea) + +Fedora-patch: libvirt-fix-device-detach-typo3.patch +--- + src/qemu_driver.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/qemu_driver.c b/src/qemu_driver.c +index 7c7b985..550a59c 100644 +--- a/src/qemu_driver.c ++++ b/src/qemu_driver.c +@@ -6126,7 +6126,7 @@ static int qemudDomainDetachHostPciDevice(virConnectPtr conn, + virDomainObjPtr vm, + virDomainDeviceDefPtr dev) + { +- virDomainHostdevDefPtr detach; ++ virDomainHostdevDefPtr detach = NULL; + char *cmd, *reply; + int i, ret; + pciDevice *pci; +-- +1.6.2.5 + diff --git a/libvirt-fix-libvirtd-leak-in-error-reply.patch b/libvirt-fix-libvirtd-leak-in-error-reply.patch new file mode 100644 index 0000000..057ff65 --- /dev/null +++ b/libvirt-fix-libvirtd-leak-in-error-reply.patch @@ -0,0 +1,79 @@ +From 71de8d92f20a9a9ee76d4d5df77ff477f1b7d441 Mon Sep 17 00:00:00 2001 +From: Matthias Bolte +Date: Wed, 30 Sep 2009 02:17:27 +0200 +Subject: [PATCH] Fix memory leaks in libvirtd's message processing + +Commit 47cab734995fa9521b1df05d37e9978eedd8d3a2 changed the way how +qemud_client_message objects were reused. Before this commit +remoteDispatchClientRequest() reused the received message for normal responses +and to report non-fatal errors. If a fatal error occurred qemudWorker() frees +the message. After this commit non-fatal errors are reported by +remoteSerializeReplyError() using a new qemud_client_message object and the +original message leaks. + +To fix this leak the original message has to be freed if +remoteSerializeReplyError() succeeds. If remoteSerializeReplyError() +fails the original message is freed in qemudWorker(). + +* daemon/dispatch.c: free qemud_client_message objects that will not be reused + and would leak otherwise, also free the allocated qemud_client_message object + in remoteSerializeError() if an error occurs + +(cherry-picked from commit c6f1459eb998619ab21a92d9bb87341f26978181) + +Fedora-patch: libvirt-fix-libvirtd-leak-in-error-reply.patch +--- + qemud/dispatch.c | 15 +++++++++++++-- + 1 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/qemud/dispatch.c b/qemud/dispatch.c +index a60f2f4..ddb3215 100644 +--- a/qemud/dispatch.c ++++ b/qemud/dispatch.c +@@ -191,6 +191,7 @@ remoteSerializeError(struct qemud_client *client, + + xdr_error: + xdr_destroy(&xdr); ++ VIR_FREE(msg); + fatal_error: + xdr_free((xdrproc_t)xdr_remote_error, (char *)rerr); + return -1; +@@ -336,6 +337,7 @@ remoteDispatchClientRequest (struct qemud_server *server, + struct qemud_client *client, + struct qemud_client_message *msg) + { ++ int ret; + remote_error rerr; + + memset(&rerr, 0, sizeof rerr); +@@ -364,7 +366,12 @@ remoteDispatchClientRequest (struct qemud_server *server, + } + + error: +- return remoteSerializeReplyError(client, &rerr, &msg->hdr); ++ ret = remoteSerializeReplyError(client, &rerr, &msg->hdr); ++ ++ if (ret >= 0) ++ VIR_FREE(msg); ++ ++ return ret; + } + + +@@ -521,8 +528,12 @@ remoteDispatchClientCall (struct qemud_server *server, + rpc_error: + /* Semi-bad stuff happened, we can still try to send back + * an RPC error message to client */ +- return remoteSerializeReplyError(client, &rerr, &msg->hdr); ++ rv = remoteSerializeReplyError(client, &rerr, &msg->hdr); ++ ++ if (rv >= 0) ++ VIR_FREE(msg); + ++ return rv; + + xdr_error: + /* Seriously bad stuff happened, so we'll kill off this client +-- +1.6.2.5 + diff --git a/libvirt.spec b/libvirt.spec index c674e6b..59dc021 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -151,7 +151,7 @@ Summary: Library providing a simple API virtualization Name: libvirt Version: 0.7.1 -Release: 10%{?dist}%{?extra_release} +Release: 11%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries Source: http://libvirt.org/sources/libvirt-%{version}.tar.gz @@ -179,6 +179,14 @@ Patch07: libvirt-svirt-relabel-qcow2-backing-files.patch Patch08: libvirt-change-logrotate-config-to-weekly.patch Patch09: libvirt-logrotate-create-lxc-uml-dirs.patch +# Add several PCI hot-unplug typo fixes from upstream +Patch10: libvirt-fix-device-detach-typo1.patch +Patch11: libvirt-fix-device-detach-typo2.patch +Patch12: libvirt-fix-device-detach-typo3.patch + +# Fix libvirtd memory leak during error reply sending (#528162) +Patch13: libvirt-fix-libvirtd-leak-in-error-reply.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://libvirt.org/ BuildRequires: python-devel @@ -403,6 +411,10 @@ of recent versions of Linux (and other OSes). %patch07 -p1 %patch08 -p1 %patch09 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 %build # Needed for libvirt-logrotate-create-lxc-uml-dirs.patch @@ -797,6 +809,10 @@ fi %endif %changelog +* Fri Oct 9 2009 Mark McLoughlin - 0.7.1-11 +- Fix libvirtd memory leak during error reply sending (#528162) +- Add several PCI hot-unplug typo fixes from upstream + * Tue Oct 6 2009 Mark McLoughlin - 0.7.1-10 - Create /var/log/libvirt/{lxc,uml} dirs for logrotate - Make libvirt-python dependon on libvirt-client