From: Cole Robinson Date: Mon, 10 Aug 2015 23:01:43 +0000 (-0400) Subject: domain: Fix crash if trying to live update disk X-Git-Tag: v1.2.18.1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79be4dbecb9a6dc77b51fdb0a966c9eac835318a;p=thirdparty%2Flibvirt.git domain: Fix crash if trying to live update disk If you pass XML to UpdateDevice, and the original device didn't have a 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. (cherry picked from commit c7790408d7e16b1ad00a690433d9310f104994f7) --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2837ba9700..9a53a35be9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5815,28 +5815,28 @@ virDomainDiskDiffersSourceOnly(virDomainDiskDefPtr disk, 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, _("cannot modify field '%s' of the disk"), "serial"); 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, _("cannot modify field '%s' of the disk"), "wwn"); 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, _("cannot modify field '%s' of the disk"), "vendor"); 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, _("cannot modify field '%s' of the disk"), "product");