diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2017-04-16 15:57:18 -0600 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2017-04-18 15:01:15 -0600 |
commit | 80dbe1fbafbf469fd19862f0d400b769bff0ee46 (patch) | |
tree | 0e325bcf0e3990f28365485a146a2bae6467070a /usr | |
parent | 0cfef2b7410b64d7a430947e0b533314c4f97153 (diff) | |
download | linux-80dbe1fbafbf469fd19862f0d400b769bff0ee46.tar.gz linux-80dbe1fbafbf469fd19862f0d400b769bff0ee46.tar.bz2 linux-80dbe1fbafbf469fd19862f0d400b769bff0ee46.zip |
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>
Diffstat (limited to 'usr')
0 files changed, 0 insertions, 0 deletions