Skip to content
Snippets Groups Projects
Commit 6fdc00b1 authored by Laurent Léonard's avatar Laurent Léonard
Browse files

Drop patches.

0005-Also-look-for-dmi-information-in-sys-class.patch - applied upstream 4c81b0fdc57b23d80b1b4752cd6143d15c02e9c8.
0007-Implement-path-lookup-for-USB-by-vendor-product.patch - fixed upstream 5073aa994af460e775cb3e548528e28d7660fcc8.
0008-qemu-Use-log-output-for-pty-assignment-if-info-chard.patch - fixed upstream a0356bcc41470684f4683f86af8eaea0154fd324.
0009-Fix-QEMU-driver-custom-domain-status-XML-extensions.patch - fixed upstream ed00e45dba56d25f7231283ccfe8e6890b3b88dd.
0010-Don-t-free-an-uninitalized-pointer-in-update_driver_.patch - fixed upstream 338e7c3c8d5b861f3ad376863519f3496736987e.
0011-Fix-parsing-of-info-chardev-line-endings.patch - fixed upstream c0a9b6a5338e54b64a4a28415ffbdb6bcc2b38c5.
parent 0f126ad6
No related branches found
No related tags found
No related merge requests found
Showing
with 8 additions and 698 deletions
......@@ -7,7 +7,7 @@ Subject: [PATCH] remove-RHism.diff
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index ee8cc11..d2458f5 100644
index 10f622f..f76b8e5 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -34,7 +34,7 @@ the program.
......
......@@ -8,10 +8,10 @@ Subject: [PATCH] qemu-disable-network.diff
2 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 8ef0e81..f59eb08 100644
index 3232256..f7a793a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -913,9 +913,6 @@ if WITH_NETWORK
@@ -923,9 +923,6 @@ if WITH_NETWORK
test -z "$(UUID)" || \
sed -i -e "s,</name>,</name>\n <uuid>$(UUID)</uuid>," \
$(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml
......@@ -22,10 +22,10 @@ index 8ef0e81..f59eb08 100644
uninstall-local::
diff --git a/src/Makefile.in b/src/Makefile.in
index 5301dfc..143fe64 100644
index c244753..06d6d20 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -4197,9 +4197,6 @@ install-data-local:
@@ -4283,9 +4283,6 @@ install-data-local:
@WITH_NETWORK_TRUE@ test -z "$(UUID)" || \
@WITH_NETWORK_TRUE@ sed -i -e "s,</name>,</name>\n <uuid>$(UUID)</uuid>," \
@WITH_NETWORK_TRUE@ $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/default.xml
......
......@@ -12,10 +12,10 @@ Closes: #517059
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 8279a74..5001d91 100644
index 16c91e1..633f6af 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2230,7 +2230,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
@@ -2288,7 +2288,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn,
"/usr/lib64/xen/bin/qemu-dm" :
"/usr/lib/xen/bin/qemu-dm"),
(guest_archs[i].hvm ?
......
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Thu, 7 Jan 2010 10:13:51 +0100
Subject: [PATCH] Also look for dmi information in /sys/class
older kernels such as 2.6.26 have it there.
---
src/node_device/node_device_udev.c | 7 ++++++-
src/node_device/node_device_udev.h | 1 +
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 22c5f2b..7a9c1e5 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1407,7 +1407,12 @@ static int udevSetupSystemDev(void)
device = udev_device_new_from_syspath(udev, DMI_DEVPATH);
if (device == NULL) {
VIR_ERROR("Failed to get udev device for syspath '%s'\n", DMI_DEVPATH);
- goto out;
+
+ device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
+ if (device == NULL) {
+ VIR_ERROR("Failed to get udev device for syspath '%s'\n", DMI_DEVPATH_FALLBACK);
+ goto out;
+ }
}
data = &def->caps->data;
diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_device_udev.h
index 0fd39ae..6c83412 100644
--- a/src/node_device/node_device_udev.h
+++ b/src/node_device/node_device_udev.h
@@ -26,6 +26,7 @@
#define SYSFS_DATA_SIZE 4096
#define DRV_STATE_UDEV_MONITOR(ds) ((struct udev_monitor *)((ds)->privateData))
#define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
+#define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
#define PROPERTY_FOUND 0
#define PROPERTY_MISSING 1
#define PROPERTY_ERROR -1
--
From: Cole Robinson <crobinso@redhat.com>
Date: Wed, 13 Jan 2010 15:50:05 -0500
Subject: [PATCH] Implement path lookup for USB by vendor:product
Based off how QEMU does it, look through /sys/bus/usb/devices/* for
matching vendor:product info, and if found, use info from the surrounding
files to build the device's /dev/bus/usb path.
This fixes USB device assignment by vendor:product when running qemu
as non-root (well, it should, but for some reason I couldn't reproduce
the failure people are seeing in [1], but it appears to work properly)
[1] https://bugzilla.redhat.com/show_bug.cgi?id=542450
v2:
Drop 'bus.addr only' checks in security drivers
Use various util helpers
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
po/POTFILES.in | 1 +
src/qemu/qemu_driver.c | 9 +--
src/security/security_selinux.c | 25 ++++-----
src/security/virt-aa-helper.c | 32 +++++------
src/util/hostusb.c | 110 +++++++++++++++++++++++++++++++++++++-
src/util/hostusb.h | 4 +-
6 files changed, 141 insertions(+), 40 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1ab0859..22e9c3c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -54,6 +54,7 @@ src/uml/uml_conf.c
src/uml/uml_driver.c
src/util/bridge.c
src/util/conf.c
+src/util/hostusb.c
src/util/json.c
src/util/logging.c
src/util/pci.c
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a6a1a5a..7dfa78f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2099,14 +2099,11 @@ static int qemuDomainSetHostdevUSBOwnership(virConnectPtr conn,
struct qemuFileOwner owner = { uid, gid };
int ret = -1;
- /* XXX what todo for USB devs assigned based on product/vendor ? Doom :-( */
- if (!def->source.subsys.u.usb.bus ||
- !def->source.subsys.u.usb.device)
- return 0;
-
usbDevice *dev = usbGetDevice(conn,
def->source.subsys.u.usb.bus,
- def->source.subsys.u.usb.device);
+ def->source.subsys.u.usb.device,
+ def->source.subsys.u.usb.vendor,
+ def->source.subsys.u.usb.product);
if (!dev)
goto cleanup;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 000bc8a..cb585ed 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -481,20 +481,17 @@ SELinuxSetSecurityHostdevLabel(virConnectPtr conn,
switch (dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
- if (dev->source.subsys.u.usb.bus && dev->source.subsys.u.usb.device) {
- usbDevice *usb = usbGetDevice(conn,
- dev->source.subsys.u.usb.bus,
- dev->source.subsys.u.usb.device);
+ usbDevice *usb = usbGetDevice(conn,
+ dev->source.subsys.u.usb.bus,
+ dev->source.subsys.u.usb.device,
+ dev->source.subsys.u.usb.vendor,
+ dev->source.subsys.u.usb.product);
- if (!usb)
- goto done;
+ if (!usb)
+ goto done;
- ret = usbDeviceFileIterate(conn, usb, SELinuxSetSecurityUSBLabel, vm);
- usbFreeDevice(conn, usb);
- } else {
- /* XXX deal with product/vendor better */
- ret = 0;
- }
+ ret = usbDeviceFileIterate(conn, usb, SELinuxSetSecurityUSBLabel, vm);
+ usbFreeDevice(conn, usb);
break;
}
@@ -556,7 +553,9 @@ SELinuxRestoreSecurityHostdevLabel(virConnectPtr conn,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
usbDevice *usb = usbGetDevice(conn,
dev->source.subsys.u.usb.bus,
- dev->source.subsys.u.usb.device);
+ dev->source.subsys.u.usb.device,
+ dev->source.subsys.u.usb.vendor,
+ dev->source.subsys.u.usb.product);
if (!usb)
goto done;
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 35b29ad..3c8b49a 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -836,24 +836,22 @@ get_files(vahControl * ctl)
virDomainHostdevDefPtr dev = ctl->def->hostdevs[i];
switch (dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
- if (dev->source.subsys.u.usb.bus &&
- dev->source.subsys.u.usb.device) {
- usbDevice *usb = usbGetDevice(NULL,
- dev->source.subsys.u.usb.bus,
- dev->source.subsys.u.usb.device);
- if (usb == NULL)
- continue;
- rc = usbDeviceFileIterate(NULL, usb,
- file_iterate_cb, &buf);
- usbFreeDevice(NULL, usb);
- if (rc != 0)
- goto clean;
- else {
- /* TODO: deal with product/vendor better */
- rc = 0;
- }
- }
+ usbDevice *usb = usbGetDevice(NULL,
+ dev->source.subsys.u.usb.bus,
+ dev->source.subsys.u.usb.device,
+ dev->source.subsys.u.usb.vendor,
+ dev->source.subsys.u.usb.product);
+
+ if (usb == NULL)
+ continue;
+
+ rc = usbDeviceFileIterate(NULL, usb,
+ file_iterate_cb, &buf);
+ usbFreeDevice(NULL, usb);
+ if (rc != 0)
+ goto clean;
break;
+ }
}
/* TODO: update so files in /sys are readonly
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
diff --git a/src/util/hostusb.c b/src/util/hostusb.c
index 07e10b1..8fbb486 100644
--- a/src/util/hostusb.c
+++ b/src/util/hostusb.c
@@ -37,9 +37,10 @@
#include "util.h"
#include "virterror_internal.h"
+#define USB_SYSFS "/sys/bus/usb"
#define USB_DEVFS "/dev/bus/usb/"
-#define USB_ID_LEN 10 /* "XXXX XXXX" */
-#define USB_ADDR_LEN 8 /* "XXX:XXX" */
+#define USB_ID_LEN 10 /* "1234 5678" */
+#define USB_ADDR_LEN 8 /* "123:456" */
struct _usbDevice {
unsigned bus;
@@ -57,11 +58,108 @@ struct _usbDevice {
virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)
+static int usbSysReadFile(virConnectPtr conn,
+ const char *f_name, const char *d_name,
+ int base, unsigned *value)
+{
+ int ret = -1, tmp;
+ char *buf = NULL;
+ char *filename = NULL;
+ char *ignore = NULL;
+
+ tmp = virAsprintf(&filename, USB_SYSFS "/devices/%s/%s", d_name, f_name);
+ if (tmp < 0) {
+ virReportOOMError(conn);
+ goto error;
+ }
+
+ if (virFileReadAll(filename, 1024, &buf) < 0)
+ goto error;
+
+ if (virStrToLong_ui(buf, &ignore, base, value) < 0) {
+ usbReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse usb file %s"), filename);
+ goto error;
+ }
+
+ ret = 0;
+error:
+ VIR_FREE(filename);
+ VIR_FREE(buf);
+ return ret;
+}
+
+static int usbFindBusByVendor(virConnectPtr conn,
+ unsigned vendor, unsigned product,
+ unsigned *bus, unsigned *devno)
+{
+ DIR *dir = NULL;
+ int ret = -1, found = 0;
+ char *ignore = NULL;
+ struct dirent *de;
+
+ dir = opendir(USB_SYSFS "/devices");
+ if (!dir) {
+ virReportSystemError(conn, errno,
+ _("Could not open directory %s"),
+ USB_SYSFS "/devices");
+ goto error;
+ }
+
+ while ((de = readdir(dir))) {
+ unsigned found_prod, found_vend;
+ if (de->d_name[0] == '.' || strchr(de->d_name, ':'))
+ continue;
+
+ if (usbSysReadFile(conn, "idVendor", de->d_name,
+ 16, &found_vend) < 0)
+ goto error;
+ if (usbSysReadFile(conn, "idProduct", de->d_name,
+ 16, &found_prod) < 0)
+ goto error;
+
+ if (found_prod == product && found_vend == vendor) {
+ /* Lookup bus.addr info */
+ char *tmpstr = de->d_name;
+ unsigned found_bus, found_addr;
+
+ if (STREQ(de->d_name, "usb"))
+ tmpstr += 3;
+
+ if (virStrToLong_ui(tmpstr, &ignore, 10, &found_bus) < 0) {
+ usbReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Failed to parse dir name '%s'"),
+ de->d_name);
+ goto error;
+ }
+
+ if (usbSysReadFile(conn, "devnum", de->d_name,
+ 10, &found_addr) < 0)
+ goto error;
+
+ *bus = found_bus;
+ *devno = found_addr;
+ found = 1;
+ break;
+ }
+ }
+
+ if (!found)
+ usbReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Did not find USB device %x:%x"), vendor, product);
+ else
+ ret = 0;
+
+error:
+ return ret;
+}
usbDevice *
usbGetDevice(virConnectPtr conn,
unsigned bus,
- unsigned devno)
+ unsigned devno,
+ unsigned vendor,
+ unsigned product)
{
usbDevice *dev;
@@ -70,6 +168,12 @@ usbGetDevice(virConnectPtr conn,
return NULL;
}
+ if (vendor) {
+ /* Look up bus.dev by vendor:product */
+ if (usbFindBusByVendor(conn, vendor, product, &bus, &devno) < 0)
+ return NULL;
+ }
+
dev->bus = bus;
dev->dev = devno;
diff --git a/src/util/hostusb.h b/src/util/hostusb.h
index 7f75c8b..739a4aa 100644
--- a/src/util/hostusb.h
+++ b/src/util/hostusb.h
@@ -28,7 +28,9 @@ typedef struct _usbDevice usbDevice;
usbDevice *usbGetDevice (virConnectPtr conn,
unsigned bus,
- unsigned devno);
+ unsigned devno,
+ unsigned vendor,
+ unsigned product);
void usbFreeDevice (virConnectPtr conn,
usbDevice *dev);
--
From: Matthias Bolte <matthias.bolte@googlemail.com>
Date: Mon, 18 Jan 2010 21:04:50 +0100
Subject: [PATCH] qemu: Use log output for pty assignment if 'info chardev' is unavailable
qemudFindCharDevicePTYsMonitor reports an error if 'info chardev' didn't
provide information for a requested device, even if the log output parsing
had found the pty path for that device. This makes pty assignment fail for
older QEMU/KVM versions. For example KVM 72 on Debian doesn't support
'info chardev', so qemuMonitorTextGetPtyPaths cannot parse any useful
information and the hash for device-id-to-pty-path mapping stays empty.
Make qemudFindCharDevicePTYsMonitor report an error only if the log output
parsing and the 'info chardev' parsing failed to provide the pty path.
---
src/qemu/qemu_driver.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7dfa78f..9e44b46 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1428,9 +1428,17 @@ qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
\
const char *path = (const char *) virHashLookup(paths, id); \
if (path == NULL) { \
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,\
- _("no assigned pty for device %s"), id); \
- return -1; \
+ if (chr->data.file.path == NULL) { \
+ /* neither the log output nor 'info chardev' had a */ \
+ /* pty path for this chardev, report an error */ \
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
+ _("no assigned pty for device %s"), id); \
+ return -1; \
+ } else { \
+ /* 'info chardev' had no pty path for this chardev, */\
+ /* but the log output had, so we're fine */ \
+ continue; \
+ } \
} \
\
chr->data.file.path = strdup(path); \
--
From: Daniel P. Berrange <berrange@redhat.com>
Date: Mon, 18 Jan 2010 16:24:25 +0000
Subject: [PATCH] Fix QEMU driver custom domain status XML extensions
Invoking the virConnectGetCapabilities() method causes the QEMU
driver to rebuild its internal capabilities object. Unfortunately
it was forgetting to register the custom domain status XML hooks
again.
To avoid this kind of error in the future, the code which builds
capabilities is refactored into one single method, which can be
called from all locations, ensuring reliable rebuilds.
* src/qemu/qemu_driver.c: Fix rebuilding of capabilities XML and
guarentee it is always consistent
---
src/qemu/qemu_driver.c | 110 +++++++++++++++++++++++-------------------------
1 files changed, 53 insertions(+), 57 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9e44b46..0d4833e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -885,34 +885,6 @@ qemuReconnectDomains(struct qemud_driver *driver)
static int
-qemudSecurityCapsInit(virSecurityDriverPtr secdrv,
- virCapsPtr caps)
-{
- const char *doi, *model;
-
- doi = virSecurityDriverGetDOI(secdrv);
- model = virSecurityDriverGetModel(secdrv);
-
- caps->host.secModel.model = strdup(model);
- if (!caps->host.secModel.model) {
- virReportOOMError(NULL);
- return -1;
- }
-
- caps->host.secModel.doi = strdup(doi);
- if (!caps->host.secModel.doi) {
- virReportOOMError(NULL);
- return -1;
- }
-
- VIR_DEBUG("Initialized caps for security driver \"%s\" with "
- "DOI \"%s\"", model, doi);
-
- return 0;
-}
-
-
-static int
qemudSecurityInit(struct qemud_driver *qemud_drv)
{
int ret;
@@ -933,15 +905,52 @@ qemudSecurityInit(struct qemud_driver *qemud_drv)
qemud_drv->securityDriver = security_drv;
VIR_INFO("Initialized security driver %s", security_drv->name);
-
- /*
- * Add security policy host caps now that the security driver is
- * initialized.
- */
- return qemudSecurityCapsInit(security_drv, qemud_drv->caps);
+ return 0;
}
+static virCapsPtr
+qemuCreateCapabilities(virCapsPtr oldcaps,
+ virSecurityDriverPtr secDriver)
+{
+ virCapsPtr caps;
+
+ /* Basic host arch / guest machine capabilities */
+ if (!(caps = qemudCapsInit(oldcaps))) {
+ virReportOOMError(NULL);
+ return NULL;
+ }
+
+ /* Domain XML parser hooks */
+ caps->privateDataAllocFunc = qemuDomainObjPrivateAlloc;
+ caps->privateDataFreeFunc = qemuDomainObjPrivateFree;
+ caps->privateDataXMLFormat = qemuDomainObjPrivateXMLFormat;
+ caps->privateDataXMLParse = qemuDomainObjPrivateXMLParse;
+
+
+ /* Security driver data */
+ if (secDriver) {
+ const char *doi, *model;
+
+ doi = virSecurityDriverGetDOI(secDriver);
+ model = virSecurityDriverGetModel(secDriver);
+
+ if (!(caps->host.secModel.model = strdup(model)))
+ goto no_memory;
+ if (!(caps->host.secModel.doi = strdup(doi)))
+ goto no_memory;
+
+ VIR_DEBUG("Initialized caps for security driver \"%s\" with "
+ "DOI \"%s\"", model, doi);
+ }
+
+ return caps;
+
+no_memory:
+ virReportOOMError(NULL);
+ virCapabilitiesFree(caps);
+ return NULL;
+}
/**
* qemudStartup:
@@ -1067,13 +1076,12 @@ qemudStartup(int privileged) {
virStrerror(-rc, buf, sizeof(buf)));
}
- if ((qemu_driver->caps = qemudCapsInit(NULL)) == NULL)
- goto out_of_memory;
+ if (qemudSecurityInit(qemu_driver) < 0)
+ goto error;
- qemu_driver->caps->privateDataAllocFunc = qemuDomainObjPrivateAlloc;
- qemu_driver->caps->privateDataFreeFunc = qemuDomainObjPrivateFree;
- qemu_driver->caps->privateDataXMLFormat = qemuDomainObjPrivateXMLFormat;
- qemu_driver->caps->privateDataXMLParse = qemuDomainObjPrivateXMLParse;
+ if ((qemu_driver->caps = qemuCreateCapabilities(NULL,
+ qemu_driver->securityDriver)) == NULL)
+ goto error;
if ((qemu_driver->activePciHostdevs = pciDeviceListNew(NULL)) == NULL)
goto error;
@@ -1097,10 +1105,6 @@ qemudStartup(int privileged) {
}
}
- if (qemudSecurityInit(qemu_driver) < 0) {
- goto error;
- }
-
/* If hugetlbfs is present, then we need to create a sub-directory within
* it, since we can't assume the root mount point has permissions that
* will let our spawned QEMU instances use it.
@@ -2859,15 +2863,12 @@ static char *qemudGetCapabilities(virConnectPtr conn) {
char *xml = NULL;
qemuDriverLock(driver);
- if ((caps = qemudCapsInit(qemu_driver->caps)) == NULL)
- goto no_memory;
- caps->privateDataAllocFunc = qemuDomainObjPrivateAlloc;
- caps->privateDataFreeFunc = qemuDomainObjPrivateFree;
-
- if (qemu_driver->securityDriver &&
- qemudSecurityCapsInit(qemu_driver->securityDriver, caps) < 0)
- goto no_memory;
+ if ((caps = qemuCreateCapabilities(qemu_driver->caps,
+ qemu_driver->securityDriver)) == NULL) {
+ virCapabilitiesFree(caps);
+ goto cleanup;
+ }
virCapabilitiesFree(qemu_driver->caps);
qemu_driver->caps = caps;
@@ -2879,11 +2880,6 @@ cleanup:
qemuDriverUnlock(driver);
return xml;
-
-no_memory:
- virCapabilitiesFree(caps);
- virReportOOMError(conn);
- goto cleanup;
}
--
From: Matthias Bolte <matthias.bolte@googlemail.com>
Date: Wed, 23 Dec 2009 21:18:04 +0000
Subject: [PATCH] Don't free an uninitalized pointer in update_driver_name()
This invalid free results in heap corruption. Some symptoms I saw
because of this were libvirtd crashing and virt-manager hanging
while trying to enumerate devices.
Closes: #565983
---
src/node_device/node_device_driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index ecbac0f..fbadfca 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -78,7 +78,7 @@ static int update_driver_name(virConnectPtr conn,
virNodeDeviceObjPtr dev)
{
char *driver_link = NULL;
- char *devpath;
+ char *devpath = NULL;
char *p;
int ret = -1;
@@ -114,7 +114,7 @@ static int update_driver_name(virConnectPtr conn,
cleanup:
VIR_FREE(driver_link);
- free(devpath);
+ VIR_FREE(devpath);
return ret;
}
#else
--
From: Matthew Booth <mbooth@redhat.com>
Date: Wed, 6 Jan 2010 17:09:04 +0100
Subject: [PATCH] Fix parsing of 'info chardev' line endings
This change makes the 'info chardev' parser ignore any trailing
whitespace on a line. This fixes a specific problem handling a '\r\n'
line ending.
* src/qemu/qemu_monitor_text.c: Ignore trailing whitespace in
'info chardev' output.
---
src/qemu/qemu_monitor_text.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index ab361c6..5b9ced2 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1705,15 +1705,26 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
goto cleanup;
}
- char *pos = reply; /* The current start of searching */
- char *end = pos + strlen(reply); /* The end of the reply string */
+ char *pos; /* The current start of searching */
+ char *next = reply; /* The start of the next line */
char *eol; /* The character which ends the current line */
+ char *end = reply + strlen(reply); /* The end of the reply string */
+
+ while (next) {
+ pos = next;
- while (pos < end) {
/* Split the output into lines */
eol = memchr(pos, '\n', end - pos);
- if (eol == NULL)
+ if (eol == NULL) {
eol = end;
+ next = NULL;
+ } else {
+ next = eol + 1;
+ }
+
+ /* Ignore all whitespace immediately before eol */
+ while (eol > pos && c_isspace(*(eol-1)))
+ eol -= 1;
/* Look for 'filename=pty:' */
#define NEEDLE "filename=pty:"
@@ -1721,13 +1732,13 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
/* If it's not there we can ignore this line */
if (!needle)
- goto next;
+ continue;
/* id is everthing from the beginning of the line to the ':'
* find ':' and turn it into a terminator */
char *colon = memchr(pos, ':', needle - pos);
if (colon == NULL)
- goto next;
+ continue;
*colon = '\0';
char *id = pos;
@@ -1747,9 +1758,6 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
goto cleanup;
}
#undef NEEDLE
-
- next:
- pos = eol + 1;
}
ret = 0;
--
......@@ -2,10 +2,4 @@
0002-qemu-disable-network.diff.patch
0003-allow-libvirt-group-to-access-the-socket.patch
0004-fix-Debian-specific-path-to-hvm-loader.patch
0005-Also-look-for-dmi-information-in-sys-class.patch
0006-Terminate-nc-on-EOF.patch
0007-Implement-path-lookup-for-USB-by-vendor-product.patch
0008-qemu-Use-log-output-for-pty-assignment-if-info-chard.patch
0009-Fix-QEMU-driver-custom-domain-status-XML-extensions.patch
0010-Don-t-free-an-uninitalized-pointer-in-update_driver_.patch
0011-Fix-parsing-of-info-chardev-line-endings.patch
0005-Terminate-nc-on-EOF.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment