[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] vfio-pci: Loosen sanity checks to allow future features



commit 86bab459489a192486ec0f49e0ef5114ff6554d2
Author:     Alex Williamson <alex.williamson@xxxxxxxxxx>
AuthorDate: Tue Jan 8 14:10:03 2013 -0700
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Tue Jan 15 23:05:45 2013 -0600

    vfio-pci: Loosen sanity checks to allow future features
    
    VFIO_PCI_NUM_REGIONS and VFIO_PCI_NUM_IRQS should never have been
    used in this manner as it locks a specific kernel implementation.
    Future features may introduce new regions or interrupt entries
    (VGA may add legacy ranges, AER might add an IRQ for error
    signalling).  Fix this before it gets us into trouble.
    
    Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
    Cc: qemu-stable@xxxxxxxxxx
    (cherry picked from commit 8fc94e5a8046e349e07976f9bcaffbcd5833f3a2)
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 hw/vfio_pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/vfio_pci.c b/hw/vfio_pci.c
index 46dce55..283842d 100644
--- a/hw/vfio_pci.c
+++ b/hw/vfio_pci.c
@@ -1837,13 +1837,13 @@ static int vfio_get_device(VFIOGroup *group, const char 
*name, VFIODevice *vdev)
         error_report("Warning, device %s does not support reset\n", name);
     }
 
-    if (dev_info.num_regions != VFIO_PCI_NUM_REGIONS) {
+    if (dev_info.num_regions < VFIO_PCI_CONFIG_REGION_INDEX + 1) {
         error_report("vfio: unexpected number of io regions %u\n",
                      dev_info.num_regions);
         goto error;
     }
 
-    if (dev_info.num_irqs != VFIO_PCI_NUM_IRQS) {
+    if (dev_info.num_irqs < VFIO_PCI_MSIX_IRQ_INDEX + 1) {
         error_report("vfio: unexpected number of irqs %u\n", 
dev_info.num_irqs);
         goto error;
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.