提交 293668cd 编写于 作者: J Joao Martins 提交者: Jim Fehlig

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.htmlSigned-off-by: NJoao Martins <joao.m.martins@oracle.com>
上级 002b7704
......@@ -297,9 +297,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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册