diff options
-rw-r--r-- | drivers/infiniband/core/umem_odp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index 0780b1afefa9..8c4ec564e495 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c | |||
@@ -321,11 +321,15 @@ int ib_umem_odp_get(struct ib_ucontext *context, struct ib_umem *umem, | |||
321 | struct vm_area_struct *vma; | 321 | struct vm_area_struct *vma; |
322 | struct hstate *h; | 322 | struct hstate *h; |
323 | 323 | ||
324 | down_read(&mm->mmap_sem); | ||
324 | vma = find_vma(mm, ib_umem_start(umem)); | 325 | vma = find_vma(mm, ib_umem_start(umem)); |
325 | if (!vma || !is_vm_hugetlb_page(vma)) | 326 | if (!vma || !is_vm_hugetlb_page(vma)) { |
327 | up_read(&mm->mmap_sem); | ||
326 | return -EINVAL; | 328 | return -EINVAL; |
329 | } | ||
327 | h = hstate_vma(vma); | 330 | h = hstate_vma(vma); |
328 | umem->page_shift = huge_page_shift(h); | 331 | umem->page_shift = huge_page_shift(h); |
332 | up_read(&mm->mmap_sem); | ||
329 | umem->hugetlb = 1; | 333 | umem->hugetlb = 1; |
330 | } else { | 334 | } else { |
331 | umem->hugetlb = 0; | 335 | umem->hugetlb = 0; |