render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From f866045688501547c44e9708f86f11d0f9d5ca8b Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <f866045688501547c44e9708f86f11d0f9d5ca8b@dist-git>
9119d9
From: Luyao Huang <lhuang@redhat.com>
9119d9
Date: Mon, 15 Dec 2014 08:01:01 -0500
9119d9
Subject: [PATCH] conf: Fix libvirtd crash matching hostdev XML
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1174053
9119d9
9119d9
Introduced by commit id '17bddc46f' - fix a libvirtd crash when
9119d9
matching a network iscsi hostdev with a host iscsi hostdev.
9119d9
9119d9
When we use attach-device to coldplug a network iscsi hostdev,
9119d9
libvirt will check if there is already a device in XML. But if
9119d9
the 'b' is a host iscsi hostdev and 'a' is a network iscsi hostdev,
9119d9
then libvirtd will crash in virDomainHostdevMatchSubsysSCSIiSCSI
9119d9
because 'b' doesn't have a hostname.
9119d9
9119d9
Add a check in virDomainHostdevMatchSubsys, if the a's protocol
9119d9
and b's protocol is not the same.
9119d9
9119d9
Following is the backtrace:
9119d9
9119d9
0  0x00007f850d6bc307 in virDomainHostdevMatchSubsysSCSIiSCSI at conf/domain_conf.c:10889
9119d9
1  virDomainHostdevMatchSubsys at conf/domain_conf.c:10911
9119d9
2  virDomainHostdevMatch at conf/domain_conf.c:10973
9119d9
3  virDomainHostdevFind at conf/domain_conf.c:10998
9119d9
4  0x00007f84f6a10560 in qemuDomainAttachDeviceConfig at qemu/qemu_driver.c:7223
9119d9
5  qemuDomainAttachDeviceFlags at qemu/qemu_driver.c:7554
9119d9
9119d9
Signed-off-by: Luyao Huang <lhuang@redhat.com>
9119d9
(cherry picked from commit 5fc1c51743643a02c0306d6c17fe86e9013ce342)
9119d9
Signed-off-by: John Ferlan <jferlan@redhat.com>
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/conf/domain_conf.c | 3 +++
9119d9
 1 file changed, 3 insertions(+)
9119d9
9119d9
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
9119d9
index 09ddc25..25f20f8 100644
9119d9
--- a/src/conf/domain_conf.c
9119d9
+++ b/src/conf/domain_conf.c
9119d9
@@ -10900,6 +10900,9 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
9119d9
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
9119d9
         return virDomainHostdevMatchSubsysUSB(a, b);
9119d9
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
9119d9
+        if (a->source.subsys.u.scsi.protocol !=
9119d9
+            b->source.subsys.u.scsi.protocol)
9119d9
+            return 0;
9119d9
         if (a->source.subsys.u.scsi.protocol ==
9119d9
             VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
9119d9
             return virDomainHostdevMatchSubsysSCSIiSCSI(a, b);
9119d9
-- 
9119d9
2.2.0
9119d9