Re: [PATCHv6 2/7] Add virDomain{Set, Get}BlockIoTune support to the remote driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/23/2011 02:44 PM, Eric Blake wrote:
> From: Lei Li <lilei@xxxxxxxxxxxxxxxxxx>
> 
> Support Block I/O Throttle setting and query to remote driver.
> 
> Signed-off-by: Lei Li <lilei@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  daemon/remote.c              |   64 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt.c                |    1 -
>  src/remote/remote_driver.c   |   57 +++++++++++++++++++++++++++++++++++++
>  src/remote/remote_protocol.x |   27 +++++++++++++++++-
>  src/remote_protocol-structs  |   24 +++++++++++++++
>  5 files changed, 171 insertions(+), 2 deletions(-)
> 
> diff --git a/daemon/remote.c b/daemon/remote.c
> index 97c9538..8b2da0d 100644
> --- a/daemon/remote.c
> +++ b/daemon/remote.c
> @@ -1885,6 +1885,70 @@ cleanup:
>      return rv;
>  }
> 
> +static int
> +remoteDispatchDomainGetBlockIoTune(virNetServerPtr server ATTRIBUTE_UNUSED,
> +                                   virNetServerClientPtr client ATTRIBUTE_UNUSED,
> +                                   virNetMessagePtr hdr ATTRIBUTE_UNUSED,
> +                                   virNetMessageErrorPtr rerr,
> +                                   remote_domain_get_block_io_tune_args *args,
> +                                   remote_domain_get_block_io_tune_ret *ret)
> +{
> +    virDomainPtr dom = NULL;
> +    int rv = -1;
> +    virTypedParameterPtr params;

Uninit...

> +    if (nparams > REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX) {
> +        virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
> +        goto cleanup;
> +    }
> +
> +    if (VIR_ALLOC_N(params, nparams) < 0) {

...and can get to cleanup before allocation...

> +cleanup:
> +    if (rv < 0)
> +        virNetMessageSaveError(rerr);
> +    virTypedParameterArrayClear(params, nparams);
> +    VIR_FREE(params);

...which means death inside free().  Oops.

I'm squashing this in:

diff --git i/daemon/remote.c w/daemon/remote.c
index 12ac6c2..e1d208c 100644
--- i/daemon/remote.c
+++ w/daemon/remote.c
@@ -1901,7 +1901,7 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr
server ATTRIBUTE_UNUSED,
 {
     virDomainPtr dom = NULL;
     int rv = -1;
-    virTypedParameterPtr params;
+    virTypedParameterPtr params = NULL;
     int nparams = args->nparams;
     struct daemonClientPrivate *priv =
         virNetServerClientGetPrivateData(client);


-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]