Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eca85988 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Greg Kroah-Hartman
Browse files

RDMA/i40w: Hold read semaphore while looking after VMA



[ Upstream commit 5d9a2b0e28759e319a623da33940dbb3ce952b7d ]

VMA lookup is supposed to be performed while mmap_sem is held.

Fixes: f26c7c83 ("i40iw: Add 2MB page support")
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e862ab6b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1408,6 +1408,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);
@@ -1416,6 +1417,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);
}

/**