libvirt/4cd3f241-fix-NULL-disk-source.patch
James Fehlig 9ae4fe010c Accepting request 497372 from home:jfehlig:branches:Virtualization
- libxl: add default listen address for VNC and spice
  975ea20f-loopback-macro.patch,
  dbb85e0c-libxl-graphics-listen-addr.patch
  bsc#1040207
- xenconfig: fix handling of NULL disk source
  4cd3f241-fix-NULL-disk-source.patch
  bsc#1040213

OBS-URL: https://build.opensuse.org/request/show/497372
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=604
2017-05-22 17:49:23 +00:00

55 lines
2.4 KiB
Diff

commit 4cd3f241399eb691a7fc9a1279938bfe76215a77
Author: Wim ten Have <wim.ten.have@oracle.com>
Date: Fri May 19 16:38:43 2017 +0200
xenconfig: fix handling of NULL disk source
It is possible to crash libvirtd when converting xl native config to
domXML when the xl config contains an empty disk source, e.g. an empty
CDROM. Fix by checking that the disk source is non-NULL before parsing it.
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Index: libvirt-3.3.0/src/xenconfig/xen_xl.c
===================================================================
--- libvirt-3.3.0.orig/src/xenconfig/xen_xl.c
+++ libvirt-3.3.0/src/xenconfig/xen_xl.c
@@ -316,6 +316,10 @@ xenParseXLDiskSrc(virDomainDiskDefPtr di
char *tmpstr = NULL;
int ret = -1;
+ /* A NULL source is valid, e.g. an empty CDROM */
+ if (srcstr == NULL)
+ return 0;
+
if (STRPREFIX(srcstr, "rbd:")) {
if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\")))
goto cleanup;
Index: libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.cfg
===================================================================
--- libvirt-3.3.0.orig/tests/xlconfigdata/test-disk-positional-parms-partial.cfg
+++ libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.cfg
@@ -22,4 +22,4 @@ parallel = "none"
serial = "none"
builder = "hvm"
boot = "d"
-disk = [ "/dev/HostVG/XenGuest2,,hda,,backendtype=phy", "/var/lib/libvirt/images/XenGuest2-home,,hdb,,", "/root/boot.iso,,hdc,,devtype=cdrom" ]
+disk = [ "/dev/HostVG/XenGuest2,,hda,,backendtype=phy", "/var/lib/libvirt/images/XenGuest2-home,,hdb,,", "/root/boot.iso,,hdc,,devtype=cdrom" , "format=raw,vdev=hdd,access=ro,devtype=cdrom" ]
Index: libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.xml
===================================================================
--- libvirt-3.3.0.orig/tests/xlconfigdata/test-disk-positional-parms-partial.xml
+++ libvirt-3.3.0/tests/xlconfigdata/test-disk-positional-parms-partial.xml
@@ -39,6 +39,12 @@
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <target dev='hdd' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1' target='0' unit='1'/>
+ </disk>
<controller type='ide' index='0'/>
<interface type='bridge'>
<mac address='00:16:3e:66:92:9c'/>