提交 c7790408 编写于 作者: C Cole Robinson

domain: Fix crash if trying to live update disk <serial>

If you pass <disk><serial> XML to UpdateDevice, and the original device
didn't have a <serial> block, libvirtd crashes trying to read the original
NULL serial string.

Use _NULLABLE string comparisons to avoid the crash. A couple other
properties needed the change too.
上级 9bd16ad3
...@@ -5871,28 +5871,28 @@ virDomainDiskDiffersSourceOnly(virDomainDiskDefPtr disk, ...@@ -5871,28 +5871,28 @@ virDomainDiskDiffersSourceOnly(virDomainDiskDefPtr disk,
CHECK_EQ(transient, "transient", true); CHECK_EQ(transient, "transient", true);
if (disk->serial && STRNEQ(disk->serial, orig_disk->serial)) { if (disk->serial && STRNEQ_NULLABLE(disk->serial, orig_disk->serial)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"), _("cannot modify field '%s' of the disk"),
"serial"); "serial");
return false; return false;
} }
if (disk->wwn && STRNEQ(disk->wwn, orig_disk->wwn)) { if (disk->wwn && STRNEQ_NULLABLE(disk->wwn, orig_disk->wwn)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"), _("cannot modify field '%s' of the disk"),
"wwn"); "wwn");
return false; return false;
} }
if (disk->vendor && STRNEQ(disk->vendor, orig_disk->vendor)) { if (disk->vendor && STRNEQ_NULLABLE(disk->vendor, orig_disk->vendor)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"), _("cannot modify field '%s' of the disk"),
"vendor"); "vendor");
return false; return false;
} }
if (disk->product && STRNEQ(disk->product, orig_disk->product)) { if (disk->product && STRNEQ_NULLABLE(disk->product, orig_disk->product)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot modify field '%s' of the disk"), _("cannot modify field '%s' of the disk"),
"product"); "product");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册