aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/vfio/pci/vfio_pci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index b423a309a6e0..125b58eff936 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -28,6 +28,7 @@
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/vfio.h> 29#include <linux/vfio.h>
30#include <linux/vgaarb.h> 30#include <linux/vgaarb.h>
31#include <linux/nospec.h>
31 32
32#include "vfio_pci_private.h" 33#include "vfio_pci_private.h"
33 34
@@ -727,6 +728,9 @@ static long vfio_pci_ioctl(void *device_data,
727 if (info.index >= 728 if (info.index >=
728 VFIO_PCI_NUM_REGIONS + vdev->num_regions) 729 VFIO_PCI_NUM_REGIONS + vdev->num_regions)
729 return -EINVAL; 730 return -EINVAL;
731 info.index = array_index_nospec(info.index,
732 VFIO_PCI_NUM_REGIONS +
733 vdev->num_regions);
730 734
731 i = info.index - VFIO_PCI_NUM_REGIONS; 735 i = info.index - VFIO_PCI_NUM_REGIONS;
732 736