Repository navigation
Commit 80dbe1f
Alex Williamson
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>1 parent 0cfef2b commit 80dbe1f
1 file changed
Lines changed: 8 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
486 | | - | |
487 | 485 | | |
488 | 486 | | |
489 | | - | |
490 | 487 | | |
491 | 488 | | |
492 | 489 | | |
493 | 490 | | |
494 | 491 | | |
495 | 492 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 493 | + | |
| 494 | + | |
513 | 495 | | |
514 | 496 | | |
515 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
516 | 502 | | |
517 | 503 | | |
518 | 504 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | 505 | | |
523 | 506 | | |
524 | 507 | | |
| |||
598 | 581 | | |
599 | 582 | | |
600 | 583 | | |
601 | | - | |
602 | | - | |
| 584 | + | |
603 | 585 | | |
604 | | - | |
605 | 586 | | |
606 | 587 | | |
607 | 588 | | |
| |||
0 commit comments