summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-20 14:27:02 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-20 14:27:02 -0700
commit48e5aee81f320da8abd1f09c8410f584315f59b0 (patch)
treedaa5ed57290834eaca122e2d44e38bd1abf573b3
parentb4460a9586c381edcec6a702ec8cfc80995063fc (diff)
parent0e714d27786ce1fb3efa9aac58abc096e68b1c2a (diff)
Merge tag 'vfio-v4.18-rc6' of git://github.com/awilliam/linux-vfio
Pull VFIO fix from Alex Williamson: "Harden potential Spectre v1 issue (Gustavo A. R. Silva)" * tag 'vfio-v4.18-rc6' of git://github.com/awilliam/linux-vfio: vfio/pci: Fix potential Spectre v1
-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 @@
#include <linux/uaccess.h>
#include <linux/vfio.h>
#include <linux/vgaarb.h>
+#include <linux/nospec.h>
#include "vfio_pci_private.h"
@@ -727,6 +728,9 @@ static long vfio_pci_ioctl(void *device_data,
if (info.index >=
VFIO_PCI_NUM_REGIONS + vdev->num_regions)
return -EINVAL;
+ info.index = array_index_nospec(info.index,
+ VFIO_PCI_NUM_REGIONS +
+ vdev->num_regions);
i = info.index - VFIO_PCI_NUM_REGIONS;