summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYishai Hadas <yishaih@mellanox.com>2019-12-22 14:46:48 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-11 04:34:13 -0800
commit48d33701f6cf1d2925b5606eb7e7a0813d53b89c (patch)
tree49c3a4c7fbac8ce097d149c783f3b221ee577f16
parentd12e357f676b7b1f65daa1b0cea7a572f3626eee (diff)
downloadlinux-stable-48d33701f6cf1d2925b5606eb7e7a0813d53b89c.tar.gz
linux-stable-48d33701f6cf1d2925b5606eb7e7a0813d53b89c.tar.bz2
linux-stable-48d33701f6cf1d2925b5606eb7e7a0813d53b89c.zip
IB/core: Fix ODP get user pages flow
commit d07de8bd1709a80a282963ad7b2535148678a9e4 upstream. The nr_pages argument of get_user_pages_remote() should always be in terms of the system page size, not the MR page size. Use PAGE_SIZE instead of umem_odp->page_shift. Fixes: 403cd12e2cf7 ("IB/umem: Add contiguous ODP support") Link: https://lore.kernel.org/r/20191222124649.52300-3-leon@kernel.org Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/infiniband/core/umem_odp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index 6ec748eccff7..4bda1242df87 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -689,7 +689,7 @@ int ib_umem_odp_map_dma_pages(struct ib_umem *umem, u64 user_virt, u64 bcnt,
while (bcnt > 0) {
const size_t gup_num_pages = min_t(size_t,
- (bcnt + BIT(page_shift) - 1) >> page_shift,
+ ALIGN(bcnt, PAGE_SIZE) / PAGE_SIZE,
PAGE_SIZE / sizeof(struct page *));
down_read(&owning_mm->mmap_sem);