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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 18, 2016 at 09:26:27AM -0500, John Ferlan wrote:
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@xxxxxxxxxx>
---
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))


Is this needed after patch 3/11?

I presume we do not store objects with NULL names in devs. In that case
the callers should avoid calling this with NULL name - what is the point
of iterating over the array in that case?

Jan

            return devs->objs[i];
        virNodeDeviceObjUnlock(devs->objs[i]);
    }

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux