summaryrefslogtreecommitdiff
path: root/drivers/iommu/amd_iommu_v2.c
diff options
context:
space:
mode:
authorJay Cornwall <jay.cornwall@amd.com>2014-04-29 02:27:46 +0400
committerJoerg Roedel <joro@8bytes.org>2014-05-13 14:33:11 +0400
commit4378d99295fae5fd42b0ed1a3eeef2a1684e0c17 (patch)
tree2d2206643e5ad7353fba8393b1e6820daae45dc9 /drivers/iommu/amd_iommu_v2.c
parente028a9e6b8a637af09ac4114083280df4a7045f1 (diff)
downloadlinux-4378d99295fae5fd42b0ed1a3eeef2a1684e0c17.tar.xz
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 5208828792e6..203b2e6a91cf 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);