On 17.07.2019 03:00, Marek Marczykowski-Górecki  wrote:
> --- a/xen/arch/x86/physdev.c
> +++ b/xen/arch/x86/physdev.c
> @@ -662,6 +662,31 @@ ret_t do_physdev_op(int cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>           break;
>       }
>   
> +    case PHYSDEVOP_msi_control: {
> +        struct physdev_msi_control op;
> +        struct pci_dev *pdev;
> +
> +        ret = -EFAULT;
> +        if ( copy_from_guest(&op, arg, 1) )
> +            break;
> +
> +        ret = -EINVAL;
> +        if ( op.flags & ~(PHYSDEVOP_MSI_CONTROL_MSIX | 
> PHYSDEVOP_MSI_CONTROL_ENABLE) )
> +            break;
> +
> +        pcidevs_lock();
> +        pdev = pci_get_pdev(op.seg, op.bus, op.devfn);
> +        if ( pdev )
> +            ret = msi_control(pdev,
> +                              op.flags & PHYSDEVOP_MSI_CONTROL_MSIX,
> +                              op.flags & PHYSDEVOP_MSI_CONTROL_ENABLE);

Note that pci_get_pdev() returns hidden devices as well. That's
not a problem for the other two uses in this file, but I think
you want to explicitly deny access to hidden ones here,
irrespective of the XSM check.

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to