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

Ján Tomko jtomko at redhat.com
Mon Jan 2 14:16:41 UTC 2017


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 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))


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]);
>     }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170102/1621cf73/attachment-0001.sig>


More information about the libvir-list mailing list