render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From f6a05ac3cb33c473de8ed49b53d22910fc0140df Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <f6a05ac3cb33c473de8ed49b53d22910fc0140df@dist-git>
d76c62
From: John Ferlan <jferlan@redhat.com>
d76c62
Date: Wed, 16 Jan 2019 15:54:31 -0500
d76c62
Subject: [PATCH] RHEL: qemu: Fix logic error in qemuSetUnprivSGIO
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1666605
d76c62
d76c62
RHEL-only
d76c62
d76c62
Commit c0f26a13c6 had a logic error with using both DISK and
d76c62
sgio which resulted in a DISK that didn't have sgio set falling
d76c62
into the else clause and trying to deref a NULL @hostdev resulting
d76c62
in a libvirtd crash:
d76c62
d76c62
Thread 1 (Thread 0x7ffbc6353700 (LWP 12642)):
d76c62
 0  0x00007ffb958e7d7a in qemuSetUnprivSGIO
d76c62
 1  0x00007ffb958d9d92 in qemuDomainAttachDeviceDiskLive
d76c62
 2  0x00007ffb9594fce8 in qemuDomainAttachDeviceFlags
d76c62
 3  0x00007ffbde399d71 in virDomainAttachDevice
d76c62
 4  0x0000563b73ded4b2 in remoteDispatchDomainAttachDeviceHelper
d76c62
d76c62
for hotplug of XML:
d76c62
d76c62
<disk device="lun" type="block">
d76c62
  <source dev="/dev/sdb"/>
d76c62
  <driver name="qemu" type="raw"/>
d76c62
  <target bus="scsi" dev="sdb"/>
d76c62
</disk>
d76c62
d76c62
Signed-off-by: John Ferlan <jferlan@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_conf.c | 6 +++---
d76c62
 1 file changed, 3 insertions(+), 3 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
d76c62
index 590052b035..0674292fab 100644
d76c62
--- a/src/qemu/qemu_conf.c
d76c62
+++ b/src/qemu/qemu_conf.c
d76c62
@@ -1856,9 +1856,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
d76c62
         return -1;
d76c62
 
d76c62
     /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0.  */
d76c62
-    if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
d76c62
-        disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
d76c62
-        val = 1;
d76c62
+    if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
d76c62
+        if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
d76c62
+            val = 1;
d76c62
     } else {
d76c62
         /* Only settable if <shareable/> was present for hostdev */
d76c62
         if (qemuIsSharedHostdev(hostdev) &&
d76c62
-- 
d76c62
2.25.0
d76c62