]> git.baikalelectronics.ru Git - kernel.git/commit
vfio: Use get_user_pages_longterm correctly
authorJason Gunthorpe <jgg@mellanox.com>
Fri, 29 Jun 2018 17:31:50 +0000 (11:31 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Sat, 30 Jun 2018 19:58:09 +0000 (13:58 -0600)
commit8ae5820f6192dee0ed521c10fc2dc0277b26271f
tree452551a00278b41d599598e1e80eed6b2e7c365b
parent0b340cfded93896035c7f323498524f3da21e33c
vfio: Use get_user_pages_longterm correctly

The patch noted in the fixes below converted get_user_pages_fast() to
get_user_pages_longterm(), however the two calls differ in a few ways.

First _fast() is documented to not require the mmap_sem, while _longterm()
is documented to need it. Hold the mmap sem as required.

Second, _fast accepts an 'int write' while _longterm uses 'unsigned int
gup_flags', so the expression '!!(prot & IOMMU_WRITE)' is only working by
luck as FOLL_WRITE is currently == 0x1. Use the expected FOLL_WRITE
constant instead.

Fixes: d7e900255432 ("vfio: disable filesystem-dax page pinning")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c