Skip to content

Commit

Permalink
iommu/amd: Take mmap_sem when calling get_user_pages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jay Cornwall authored and Joerg Roedel committed May 13, 2014
1 parent e028a9e commit 4378d99
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/iommu/amd_iommu_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4378d99

Please sign in to comment.