diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2012-06-15 15:56:20 +0200 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-06-16 04:22:12 +0200 |
commit | f961f72836eb6c0fd76201f6f6b2fafff93c4cea (patch) | |
tree | e816a93debb5d46b55cce1c5e743b4d541c59032 /virt | |
parent | Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/... (diff) | |
download | linux-f961f72836eb6c0fd76201f6f6b2fafff93c4cea.tar.xz linux-f961f72836eb6c0fd76201f6f6b2fafff93c4cea.zip |
KVM: Fix PCI header check on device assignment
The masking was wrong (must have been 0x7f), and there is no need to
re-read the value as pci_setup_device already does this for us.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43339
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/assigned-dev.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 01f572c10c71..b1e091ae2f37 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -635,7 +635,6 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, int r = 0, idx; struct kvm_assigned_dev_kernel *match; struct pci_dev *dev; - u8 header_type; if (!(assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU)) return -EINVAL; @@ -668,8 +667,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, } /* Don't allow bridges to be assigned */ - pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); - if ((header_type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL) { + if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL) { r = -EPERM; goto out_put; } |