From: John Ferlan Date: Tue, 5 Dec 2017 21:03:34 +0000 (-0500) Subject: qemu: Tolerate storage source private data being NULL for hotplug SCSI hostdev X-Git-Tag: v4.0.0-rc1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6050affb7f4ec825b95cec9d66ba0cc97501ca7e;p=thirdparty%2Flibvirt.git qemu: Tolerate storage source private data being NULL for hotplug SCSI hostdev Commit id 'c5c96545' neglected to validate that the srcPriv was non-NULL before dereferencing. Similar problem to what was fixed by commit id '8056721c' but missed during multiple rebases and code reworks. --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 24631cb8f7..c4f8c0fa4a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2286,7 +2286,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi; qemuDomainStorageSourcePrivatePtr srcPriv; - qemuDomainSecretInfoPtr secinfo; + qemuDomainSecretInfoPtr secinfo = NULL; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2328,7 +2328,8 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, goto cleanup; srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src); - secinfo = srcPriv->secinfo; + if (srcPriv) + secinfo = srcPriv->secinfo; if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) { if (qemuBuildSecretInfoProps(secinfo, &secobjProps) < 0) goto cleanup;