On Sun, Jan 30, 2011 at 01:11:15PM +0800, Sheng Yang wrote:
> Then we can support mask bit operation of assigned devices now.
> 
> Signed-off-by: Sheng Yang <sh...@linux.intel.com>

> +int kvm_vm_ioctl_register_msix_mmio(struct kvm *kvm,
> +                                 struct kvm_msix_mmio_user *mmio_user)
> +{
> +     struct kvm_msix_mmio_dev *mmio_dev = &kvm->msix_mmio_dev;
> +     struct kvm_msix_mmio *mmio = NULL;
> +     int r = 0, i;
> +
> +     mutex_lock(&mmio_dev->lock);
> +     for (i = 0; i < mmio_dev->mmio_nr; i++) {
> +             if (mmio_dev->mmio[i].dev_id == mmio_user->dev_id &&
> +                 (mmio_dev->mmio[i].type & KVM_MSIX_MMIO_TYPE_DEV_MASK) ==
> +                 (mmio_user->type & KVM_MSIX_MMIO_TYPE_DEV_MASK)) {
> +                     mmio = &mmio_dev->mmio[i];
> +                     if (mmio->max_entries_nr != mmio_user->max_entries_nr) {
> +                             r = -EINVAL;
> +                             goto out;
> +                     }
> +                     break;
> +             }

Why allow this ioctl to succeed if there's an entry already present?
This case is broken as mmio_dev->mmio_nr is increased below.

PCI bits must be reviewed...

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to