alistair23-linux/drivers/vfio
Alex Williamson 80dbe1fbaf vfio/type1: Prune vfio_pin_page_external()
With vfio_lock_acct() testing the locked memory limit under mmap_sem,
it's redundant to do it here for a single page.  We can also reorder
our tests such that we can avoid testing for reserved pages if we're
not doing accounting and let vfio_lock_acct() test the process
CAP_IPC_LOCK.  Finally, this function oddly returns 1 on success.
Update to return zero on success, -errno on error.  Since the function
only pins a single page, there's no need to return the number of pages
pinned.

N.B. vfio_pin_pages_remote() can pin a large contiguous range of pages
before calling vfio_lock_acct().  If we were to similarly remove the
extra test there, a user could temporarily pin far more pages than
they're allowed.

Suggested-by: Kirti Wankhede <kwankhede@nvidia.com>
Suggested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2017-04-18 15:01:15 -06:00
..
mdev vfio/mdev: Use a module softdep for vfio_mdev 2017-02-08 13:13:25 -07:00
pci vfio-pci: Handle error from pci_iomap 2017-01-04 08:34:39 -07:00
platform vfio_platform: Updated to use vfio_set_irqs_validate_and_prepare() 2016-11-17 08:33:20 -07:00
Kconfig vfio: Fix build break when SPAPR_TCE_IOMMU=n 2017-02-08 13:13:25 -07:00
Makefile vfio: Mediated device Core driver 2016-11-17 08:24:48 -07:00
vfio.c vfio: Rework group release notifier warning 2017-03-21 13:19:09 -06:00
vfio_iommu_spapr_tce.c vfio/spapr_tce: Check kzalloc() return when preregistering memory 2017-04-11 13:40:09 -06:00
vfio_iommu_type1.c vfio/type1: Prune vfio_pin_page_external() 2017-04-18 15:01:15 -06:00
vfio_spapr_eeh.c drivers/vfio: Support EEH error injection 2015-05-12 20:33:35 +10:00
virqfd.c vfio: Split virqfd into a separate module for vfio bus drivers 2015-03-17 08:33:38 -06:00