[libvirt] [PATCH 01/11] nodedev: Fix crash in libvirtd on vHBA creation path

John Ferlan jferlan at redhat.com
Fri Nov 18 14:26:27 UTC 2016


Providing XML such as:

<device>
  <name>vhba</name>
  <capability type='scsi_host'>
    <capability type='fc_host'>
    </capability>
  </capability>
</device>

would crash libvirt because the '<parent>' isn't a required field, but
for vHBA creation it's expected (day 1 issue - see commit id '81d0ffbc').
The nodedev.rng added in commit id '2c22a68c' has this as an optional field.
NB: On normal udev discovery if a parent field wasn't found, it would be
set to "computer" by udevSetParent, so this is a somewhat unique path.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/node_device_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 1cd0baf..bf5b22f 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -118,7 +118,7 @@ virNodeDeviceObjPtr virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
 
     for (i = 0; i < devs->count; i++) {
         virNodeDeviceObjLock(devs->objs[i]);
-        if (STREQ(devs->objs[i]->def->name, name))
+        if (STREQ_NULLABLE(devs->objs[i]->def->name, name))
             return devs->objs[i];
         virNodeDeviceObjUnlock(devs->objs[i]);
     }
-- 
2.7.4




More information about the libvir-list mailing list