[libvirt] [PATCH] virStoragePoolSourceListNewSource: avoid unconditional leak
by Jim Meyering
The buffer allocated by VIR_ALLOC here is never used, and
the sole pointer to it is overwritten by this stmt:
source = &list->sources[list->nsources++];
>From 52cf50def236ab61298ebbba39fcaf89d440f4ec Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 2 Feb 2010 19:59:14 +0100
Subject: [PATCH] virStoragePoolSourceListNewSource: avoid unconditional leak
* src/conf/storage_conf.c (virStoragePoolSourceListNewSource):
Remove an unused (and leaked) allocation.
---
src/conf/storage_conf.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index bd34f5e..62b8394 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1692,17 +1692,11 @@ virStoragePoolSourcePtr
virStoragePoolSourceListNewSource(virConnectPtr conn,
virStoragePoolSourceListPtr list)
{
virStoragePoolSourcePtr source;
- if (VIR_ALLOC(source) < 0) {
- virReportOOMError(conn);
- return NULL;
- }
-
if (VIR_REALLOC_N(list->sources, list->nsources+1) < 0) {
- VIR_FREE(source);
virReportOOMError(conn);
return NULL;
}
source = &list->sources[list->nsources++];
--
1.7.0.rc1.149.g0b0b7
14 years, 10 months
[libvirt] [PATCH] xs_internal.c: don't use a negative value as allocation size
by Jim Meyering
As the log message says...
>From 6d7abfb983328fbe34bd4404d8fafda100e8098f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 2 Feb 2010 12:22:17 +0100
Subject: [PATCH] xs_internal.c: don't use a negative value as allocation size
* src/xen/xs_internal.c (xenStoreDomainIntroduced): Don't use -1
as an allocation size upon xenStoreNumOfDomains failure.
(xenStoreDomainReleased): Likewise.
---
src/xen/xs_internal.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 1ca3da0..620c482 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -1,9 +1,9 @@
/*
* xs_internal.c: access to Xen Store
*
- * Copyright (C) 2006, 2009 Red Hat, Inc.
+ * Copyright (C) 2006, 2009-2010 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
* Daniel Veillard <veillard(a)redhat.com>
*/
@@ -1365,10 +1365,13 @@ int xenStoreDomainIntroduced(virConnectPtr conn,
xenUnifiedPrivatePtr priv = opaque;
retry:
new_domain_cnt = xenStoreNumOfDomains(conn);
+ if (new_domain_cnt < 0)
+ return -1;
+
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
virReportOOMError(NULL);
return -1;
}
nread = xenStoreDoListDomains(conn, priv, new_domids, new_domain_cnt);
@@ -1445,10 +1448,12 @@ int xenStoreDomainReleased(virConnectPtr conn,
if(!priv->activeDomainList->count) return 0;
retry:
new_domain_cnt = xenStoreNumOfDomains(conn);
+ if (new_domain_cnt < 0)
+ return -1;
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
virReportOOMError(NULL);
return -1;
}
--
1.7.0.rc1.149.g0b0b7
14 years, 10 months
[libvirt] [PATCH] interface_conf.c: don't use a negative value as allocation size
by Jim Meyering
Here's one way to solve this.
Another would be to change the way virXPathNodeSet works, but
there are several other uses of it.
>From 75108240911a1ad943e0bde8ba9ade92ea216f60 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 2 Feb 2010 20:54:01 +0100
Subject: [PATCH] interface_conf.c: don't use a negative value as allocation size
* src/conf/interface_conf.c (virInterfaceDefParseProtoIPv4): If
virXPathNodeSet returns -1, indicate failure by returning -1 right away.
(virInterfaceDefParseProtoIPv6): Likewise.
---
src/conf/interface_conf.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 8a17ed6..510df81 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -1,9 +1,9 @@
/*
* interface_conf.c: interfaces XML handling
*
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
@@ -318,10 +318,12 @@ virInterfaceDefParseProtoIPv4(virConnectPtr conn, virInterfaceProtocolDefPtr def
if (ret != 0)
return(ret);
}
nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
+ if (nIpNodes < 0)
+ return -1;
if (ipNodes == NULL)
return 0;
if (VIR_ALLOC_N(def->ips, nIpNodes) < 0) {
virReportOOMError(conn);
@@ -375,10 +377,12 @@ virInterfaceDefParseProtoIPv6(virConnectPtr conn, virInterfaceProtocolDefPtr def
if (ret != 0)
return(ret);
}
nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
+ if (nIpNodes < 0)
+ return -1;
if (ipNodes == NULL)
return 0;
if (VIR_ALLOC_N(def->ips, nIpNodes) < 0) {
virReportOOMError(conn);
--
1.7.0.rc1.167.gdb08
14 years, 10 months
[libvirt] JAVA .start() method
by Marc Gonzalez Mateo
Good morning,
Testing the new java version (0.4.1) I've noticed that there's no .start()
method to start a defined or shuted down domain.
Are you working on it or is it a minor feature not to be considered?
Thanks in advance,
Marc Gonzalez Mateo
marcg(a)ac.upc.edu
Dept. Arquitectura de Computadors
Universitat Politècnica de Catalunya
14 years, 10 months
[libvirt] [PATCH 0/6] Add more options for clock sync
by Daniel P. Berrange
This series adds two new options for clock synchronization
The two current options are:
<clock offset='utc'/>
<clock offset='localtime'/>
This introduces a way to set a timezone for localtime
<clock offset='localtime' timezone='Europe/Paris'/>
And a way to set a completely arbitrary time, by giving the number
of seconds offset from UTC.
<clock offset='variable' adjustment='123456'/>
It is open to debate whether we need to distinguish this last one
via the extra string 'variable', or just add 'adjustment' as an
optional attribute for the existing term 'utc'. Opinions welcome
14 years, 10 months
[libvirt] [PATCH] xen_hypervisor.c: avoid NULL deref for NULL domain argument
by Jim Meyering
When "domain" is NULL, don't deref NULL. Instead, just return -1,
as in many other functions in this file, and as this function did
up until a month ago.
An alternative (taken 3 times in this file) is to do this:
virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"domain or conn is NULL", 0);
return -1;
I could go either way.
>From 177556167775b806a29bcb1af7ba4294d1909912 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 26 Jan 2010 20:17:07 +0100
Subject: [PATCH] xen_hypervisor.c: avoid NULL deref for NULL domain argument
* src/xen/xen_hypervisor.c (xenHypervisorGetVcpus): Don't attempt
to diagnose an unlikely NULL-domain or NULL-domain->conn error.
---
src/xen/xen_hypervisor.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 6d8accc..0257be2 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -1,7 +1,7 @@
/*
* xen_internal.c: direct access to Xen hypervisor level
*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -3475,11 +3475,8 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
virVcpuInfoPtr ipt;
int nbinfo, i;
- if (domain == NULL || domain->conn == NULL) {
- virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
- "invalid argument", 0);
+ if (domain == NULL || domain->conn == NULL)
return -1;
- }
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || (domain->id < 0) ||
--
1.7.0.rc0.140.gfbe7
14 years, 10 months
[libvirt] libvirt: python bindings
by Sharadha Prabhakar (3P)
Hi,
I'm writing XenServer APIs for libvirt and trying to test it on virt-Manager.
I need to build the libvirt python bindings for that.
I tried this for libvirt.
./configure -with-xenapi -with-python
make
make install
I suppose this is supposed to build a .libs directory with libvirtmod.so in the ~/libvirt/python/
But I don't seem to have this at all after build. It was a clean build with no errors.
I need libvirtmod.so to link with virt-manager. I'm using libvirt version 0.7.4
Can anyone help me with this. Am I missing something here
Thanks in Advance,
-SP
14 years, 10 months
[libvirt] [PATCH] Ensure QEMU DAC security driver is activated at all times
by Daniel P. Berrange
If the primary security driver (SELinux/AppArmour) was disabled
then the secondary QEMU DAC security driver was also disabled.
This is mistaken, because the latter must be active at all times
* src/qemu/qemu_driver.c: Ensure DAC driver is always active
---
src/qemu/qemu_driver.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 16e9b56..a9313e7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -897,26 +897,28 @@ qemudSecurityInit(struct qemud_driver *qemud_drv)
int ret;
virSecurityDriverPtr security_drv;
+ qemuSecurityStackedSetDriver(qemud_drv);
+ qemuSecurityDACSetDriver(qemud_drv);
+
ret = virSecurityDriverStartup(&security_drv,
qemud_drv->securityDriverName);
if (ret == -1) {
VIR_ERROR0(_("Failed to start security driver"));
return -1;
}
- /* No security driver wanted to be enabled: just return */
+
+ /* No primary security driver wanted to be enabled: just setup
+ * the DAC driver on its own */
if (ret == -2) {
+ qemud_drv->securityDriver = &qemuDACSecurityDriver;
VIR_INFO0(_("No security driver available"));
- return 0;
+ } else {
+ qemud_drv->securityPrimaryDriver = security_drv;
+ qemud_drv->securitySecondaryDriver = &qemuDACSecurityDriver;
+ qemud_drv->securityDriver = &qemuStackedSecurityDriver;
+ VIR_INFO("Initialized security driver %s", security_drv->name);
}
- qemuSecurityStackedSetDriver(qemud_drv);
- qemuSecurityDACSetDriver(qemud_drv);
-
- qemud_drv->securityPrimaryDriver = security_drv;
- qemud_drv->securitySecondaryDriver = &qemuDACSecurityDriver;
- qemud_drv->securityDriver = &qemuStackedSecurityDriver;
-
- VIR_INFO("Initialized security driver %s", security_drv->name);
return 0;
}
--
1.6.6
14 years, 10 months
[libvirt] [PATCH 00/13] Fix device hotplug with QEMU and -device
by Daniel P. Berrange
The current libvirt code enables use of -device when launching QEMU
but forgot to update the equivalent code for hotpluging devices to
an already running QEMU. This series implements the latter, doing
three core things
- Assign a unique PCI slot to the new device
- Assign a unique device alias to the new device
- Call the device_add function for attaching the device
As a minor flaw in the whole plan, it turns out the new -netdev
code in QEMU 0.12 does not support hotplugging at all. So this
series also switching network setup back to using the old VLAN
based syntax. Hopefully we can re-introduce use of -netdev with
QEMU 0.13, since it gives important performance benefits.
14 years, 10 months
[libvirt] [PATCH] udev: Don't let strtoul parse USB busnum and devnum as octal
by Matthias Bolte
udevGetUintProperty was called with base set to 0 for busnum and devnum.
With base 0 strtoul parses the number as octal if it start with a 0. But
busnum and devnum are decimal and udev returns them padded with leading
zeros. So strtoul parses them as octal. This works for certain decimal
values like 001-007, but fails for values like 008.
Change udevProcessUSBDevice to use base 10 for busnum and devnum.
---
src/node_device/node_device_udev.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 734f3f7..0c0f29a 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -500,14 +500,14 @@ static int udevProcessUSBDevice(struct udev_device *device,
if (udevGetUintProperty(device,
"BUSNUM",
&data->usb_dev.bus,
- 0) == PROPERTY_ERROR) {
+ 10) == PROPERTY_ERROR) {
goto out;
}
if (udevGetUintProperty(device,
"DEVNUM",
&data->usb_dev.device,
- 0) == PROPERTY_ERROR) {
+ 10) == PROPERTY_ERROR) {
goto out;
}
--
1.6.3.3
14 years, 10 months