File 293668cd-xm-disk-driver-check.patch of Package libvirt.11696
From 293668cd70e11b02716386fa2e342d01c8796b1b Mon Sep 17 00:00:00 2001
From: Joao Martins <joao.m.martins@oracle.com>
Date: Tue, 24 May 2016 11:56:08 +0100
Subject: [PATCH] xenconfig: xm: check for driver on disk format
When reviewing libxl vif typename series[0] I found a bug
on xen-xm formatter where "virsh domxml-to-native xen-xm file.xml"
can lead to a NULL dereference if the disk driver isn't specified.
Fix this by checking for driver before writing/testing it down.
[0] https://www.redhat.com/archives/libvir-list/2016-April/msg01434.html
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
src/xenconfig/xen_xm.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: libvirt-1.2.18.4/src/xenconfig/xen_xm.c
===================================================================
--- libvirt-1.2.18.4.orig/src/xenconfig/xen_xm.c
+++ libvirt-1.2.18.4/src/xenconfig/xen_xm.c
@@ -322,9 +322,12 @@ xenFormatXMDisk(virConfValuePtr list,
type = "aio";
else
type = virStorageFileFormatTypeToString(format);
- virBufferAsprintf(&buf, "%s:", driver);
- if (STREQ(driver, "tap"))
- virBufferAsprintf(&buf, "%s:", type);
+
+ if (driver) {
+ virBufferAsprintf(&buf, "%s:", driver);
+ if (STREQ(driver, "tap"))
+ virBufferAsprintf(&buf, "%s:", type);
+ }
} else {
switch (virDomainDiskGetType(disk)) {
case VIR_STORAGE_TYPE_FILE: