summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu_v2.c
diff options
context:
space:
mode:
authorJay Cornwall <jay.cornwall@amd.com>2014-04-28 17:27:46 -0500
committerJoerg Roedel <joro@8bytes.org>2014-05-13 12:33:11 +0200
commit4378d99295fae5fd42b0ed1a3eeef2a1684e0c17 (patch)
tree2d2206643e5ad7353fba8393b1e6820daae45dc9 /drivers/iommu/amd_iommu_v2.c
parente028a9e6b8a637af09ac4114083280df4a7045f1 (diff)
downloadop-kernel-dev-4378d99295fae5fd42b0ed1a3eeef2a1684e0c17.zip
op-kernel-dev-4378d99295fae5fd42b0ed1a3eeef2a1684e0c17.tar.gz
iommu/amd: Take mmap_sem when calling get_user_pages
get_user_pages requires caller to hold a read lock on mmap_sem. Signed-off-by: Jay Cornwall <jay.cornwall@amd.com> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
Diffstat (limited to 'drivers/iommu/amd_iommu_v2.c')
-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 5208828..203b2e6 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -504,8 +504,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);
OpenPOWER on IntegriCloud