IB/umem: Fix missing mmap_sem in get umem ODP call
PATCH 1/1 IB/umem: Fix missing mmap_sem in get umem ODP call
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add mmap_sem lock around VMA inspection in ib_umem_odp_get().
Fixes 0008b84ea9af ('IB/umem: Add support to huge ODP')
--- drivers/infiniband/core/umem_odp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/core/umem_odp.c +5 -1
@@ -321,11 +321,15 @@ int ib_umem_odp_get(struct ib_ucontext *context, struct ib_umem *umem,struct vm_area_struct *vma;struct hstate *h; +down_read (&mm->mmap_sem); vma =find_vma (mm,ib_umem_start (umem)); -if (!vma || !is_vm_hugetlb_page (vma)) +if (!vma || !is_vm_hugetlb_page (vma)) { +up_read (&mm->mmap_sem);return -EINVAL ; + } h =hstate_vma (vma); umem->page_shift =huge_page_shift (h); +up_read (&mm->mmap_sem); umem->hugetlb =1 ; }else { umem->hugetlb =0 ;
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170521160809.19793-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Doug Ledford
AppliedQuoted 8 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add
mmap_semlock around VMA inspection inib_umem_odp_get().Fixes 0008b84ea9af ('IB/umem: Add support to huge ODP')
Thanks, applied.
Signature · 9 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html