Re: [PATCH] conf: Fix crash when src->hosts = NULL in virStorageFileBackendGlusterInit

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

 



On 11/12/14 09:47, Luyao Huang wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1162974
> 
> When do external snapshot for a gluster disk with no host name(ip) in
> snapshot xml, libvirtd will crash. Because when node do not have a children
> in virDomainStorageHostParse, libvirt will return 0, but donnot get hosts for
> virStorageFileBackendGlusterInit.
> 
> snpahost.xml:
> 
> <domainsnapshot>
> <name>snapshot_test</name>
> <description>Snapshot Test</description>
> <disks>
> <disk name='vda' snapshot='external' type='network'>
> <source protocol='gluster' name='gluster-vol1/gluster.img.snap'/>
> </disk>
> </disks>
> </domainsnapshot>
> 
> Back trace:
> virsh snapshot-create r6 snapshot.xml --disk-only
> 
> 0  virStorageFileBackendGlusterInit (src=0x7fc760007ca0) at storage/storage_backend_gluster.c:577
> 1  0x00007fc76d678e22 in virStorageFileInitAs (src=0x7fc760007ca0, uid=uid@entry=4294967295, gid=gid@entry=4294967295) at storage/storage_driver.c:2547
> 2  0x00007fc76d678e9c in virStorageFileInit (src=<optimized out>) at storage/storage_driver.c:2567
> 3  0x00007fc76bc13f9c in qemuDomainSnapshotPrepareDiskExternal (reuse=false, active=true, snapdisk=0x7fc7600019b8, disk=0x7fc7641e4880, conn=0x7fc76426cc10)
>     at qemu/qemu_driver.c:12995
> 4  qemuDomainSnapshotPrepare (flags=<synthetic pointer>, def=0x7fc760002570, vm=0x7fc76422b530, conn=0x7fc76426cc10) at qemu/qemu_driver.c:13156
> 5  qemuDomainSnapshotCreateXML (domain=0x7fc760001f30, xmlDesc=<optimized out>, flags=16) at qemu/qemu_driver.c:13896
> 6  0x00007fc782d4de4d in virDomainSnapshotCreateXML (domain=domain@entry=0x7fc760001f30,
>     xmlDesc=0x7fc760001b80 "<domainsnapshot>\n<name>snapshot_test</name>\n<description>Snapshot Test</description>\n<disks>\n<disk name='vda' snapshot='external' type='network'>\n<source protocol='gluster' name='gluster-vol1/gluster."..., flags=16) at libvirt.c:18488
> 7  0x00007fc7837cb44c in remoteDispatchDomainSnapshotCreateXML (server=<optimized out>, msg=<optimized out>, ret=0x7fc760000a60, args=0x7fc760001f90, rerr=0x7fc77344dc80,
> 
>     client=<optimized out>) at remote_dispatch.h:8605
> 
> Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 2c65276..34c1c12 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4150,7 +4150,12 @@ virDomainStorageHostParse(xmlNodePtr node,
>  
>      memset(&host, 0, sizeof(host));
>  
> -    child = node->children;
> +    if ((child = node->children) == NULL) {
> +        virReportError(VIR_ERR_XML_ERROR, "%s",
> +                               _("Can not find a host in xml"));
> +        goto cleanup;
> +    }
> +
>      while (child != NULL) {
>          if (child->type == XML_ELEMENT_NODE &&
>              xmlStrEqual(child->name, BAD_CAST "host")) {
> 

NACK,

some protocols may use implicit host names. We want to check it for
gluster only in this case.

Also Jan already sent a patch for this so there's no need to resend this.

Peter

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]