summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/i40iw
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2018-07-01 19:36:24 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-07-04 20:51:06 +0300
commit5d9a2b0e28759e319a623da33940dbb3ce952b7d (patch)
tree8abdeed3b94d508c602b239ba088024371c3f201 /drivers/infiniband/hw/i40iw
parentf1228867adaf8890826f2b59e4caddb1c5cc2df7 (diff)
downloadlinux-5d9a2b0e28759e319a623da33940dbb3ce952b7d.tar.xz
RDMA/i40w: Hold read semaphore while looking after VMA
VMA lookup is supposed to be performed while mmap_sem is held. Fixes: f26c7c83395b ("i40iw: Add 2MB page support") Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/i40iw')
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_verbs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 8884ff71a634..7d85414742ff 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -1410,6 +1410,7 @@ static void i40iw_set_hugetlb_values(u64 addr, struct i40iw_mr *iwmr)
struct vm_area_struct *vma;
struct hstate *h;
+ down_read(&current->mm->mmap_sem);
vma = find_vma(current->mm, addr);
if (vma && is_vm_hugetlb_page(vma)) {
h = hstate_vma(vma);
@@ -1418,6 +1419,7 @@ static void i40iw_set_hugetlb_values(u64 addr, struct i40iw_mr *iwmr)
iwmr->page_msk = huge_page_mask(h);
}
}
+ up_read(&current->mm->mmap_sem);
}
/**