VFIO fixes for v4.18

- Harden potential Spectre v1 issue (Gustavo A. R. Silva)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJbUkZ6AAoJECObm247sIsiykUP/0W1R4NGUDqxUfNorCoDO7l1
 Z7zuYogIar8M2gUI4/Bwgc0XTUnp2fG9oYtRxxMO+ShPLnFpLXe5tXUYX/T/iwlL
 1/rmlb8oEmHiXdre151V4wXgqgvCbzGx7e+Gp0KBnUxS+QLCFFDef0o/2iSyj4vA
 qisOwW6jD8WP5NQJguhHzelTMukdI6BdJa2PdsRtJ0f0xR/ZtSIZ6yR+QtogjyHP
 5BklBrV/xF0fLSG/UPem9uJxVD+dWeC4aU7g9Wy5oDx9GX66HeySolEULwlrtSwX
 rsYoyL42omskFsHyChKoaL2WftH1GeJ835Ba2b8ruor8OlMsbE3zSppFNuKn2cUx
 EIpGNUdvluyGKf1mSH5lmd1JSTDn8MH8NVydTM0cMbgmdm/sxgi88s0mrj4gQNTS
 L0gU3f+rGBKsQL7z6qlWWEJYTyanujHbjmAAElMmrY8ZWszOwnczwyojINnRIspu
 RQyvgzpJ0OBceg7/h/DOQfBbu1keds24aPaGxqnnmAxo8Egedayu+fBCSG2ZAaNS
 vBBR9Evr141A4AXX7Yi4qTxSrEgkG+jrHfjY7/i1zaQQ0wkOsrItYjnrTzLz4LxE
 60QO8IaaeW7UkwNMQ2OcvGGZasOB5K15Dgd7UQE2wmkwoALs+esLYeV7iMB2UrhT
 vF67ihVZwfqN9KFz37i/
 =XzK1
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2018-07-20 14:27:02 -07:00
commit 48e5aee81f

View File

@ -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;