Commit 48e5aee8 authored by Linus Torvalds's avatar Linus Torvalds

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
parents b4460a95 0e714d27
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/vfio.h> #include <linux/vfio.h>
#include <linux/vgaarb.h> #include <linux/vgaarb.h>
#include <linux/nospec.h>
#include "vfio_pci_private.h" #include "vfio_pci_private.h"
...@@ -727,6 +728,9 @@ static long vfio_pci_ioctl(void *device_data, ...@@ -727,6 +728,9 @@ static long vfio_pci_ioctl(void *device_data,
if (info.index >= if (info.index >=
VFIO_PCI_NUM_REGIONS + vdev->num_regions) VFIO_PCI_NUM_REGIONS + vdev->num_regions)
return -EINVAL; return -EINVAL;
info.index = array_index_nospec(info.index,
VFIO_PCI_NUM_REGIONS +
vdev->num_regions);
i = info.index - VFIO_PCI_NUM_REGIONS; i = info.index - VFIO_PCI_NUM_REGIONS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment