summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Cornwall <jay.cornwall@amd.com>2014-02-22 13:35:38 -0600
committerOded Gabbay <oded.gabbay@amd.com>2014-02-25 16:01:18 +0200
commit6de6b9983fe5753e5e0081f6c5533941fa949c3d (patch)
tree9e96ec26e1c3844fd6ce189bedbd8b576dbe7c6e
parent600e8bd40644134a0776d5f8992b2ddaa2a2dc3b (diff)
iommu/amd: Take mmap_sem when calling get_user_pagesalpha-1
get_user_pages requires the caller to hold a read lock on mmap_sem. Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
-rw-r--r--drivers/iommu/amd_iommu_v2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 90034b3d3075..2abb33326ab6 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -485,8 +485,10 @@ static void do_fault(struct work_struct *work)
write = !!(fault->flags & PPR_FAULT_WRITE);
+ down_read(&fault->state->mm->mmap_sem);
npages = get_user_pages(fault->state->task, fault->state->mm,
fault->address, 1, write, 0, &page, NULL);
+ up_read(&fault->state->mm->mmap_sem);
if (npages == 1) {
put_page(page);