[libvirt] [PATCH] pci: properly handle out-of-order SRIOV virtual functions

Ján Tomko jtomko at redhat.com
Wed Nov 6 12:33:57 UTC 2013


On 11/05/2013 11:43 AM, Laine Stump wrote:
> +            goto error;
> +        }
>  
> -            (*virtual_functions)[*num_virtual_functions] = config_addr;
> -            (*num_virtual_functions)++;
> +        if ((*virtual_functions)[virtfnIndex]) {
> +            virReportError(VIR_ERR_INTERNAL_ERROR,
> +                           _("Virtual function link name '%s' "
> +                             "generates duplicate index %zu "
> +                             "in physical function directory '%s'"),
> +                           virtfnNames[i], nVirtfnNames, sysfs_path);
> +            goto error;
> +        }
> +
> +        if (virPCIGetDeviceAddressFromSysfsLink(device_link, &config_addr) !=
> +            SRIOV_FOUND) {
> +            VIR_WARN("Failed to get SRIOV function from device link '%s'",
> +                     device_link);
>              VIR_FREE(device_link);
> +            continue;

(*virtual_functions)[virtfnIndex] will be left NULL here.
virNetDevGetVirtualFunctions looks like it would segfault on such array.

>          }
> +
> +        VIR_DEBUG("Found virtual function %d", virtfnIndex);
> +        (*virtual_functions)[virtfnIndex] = config_addr;
> +        VIR_FREE(device_link);
>      }
>  

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131106/75484578/attachment-0001.sig>


More information about the libvir-list mailing list