public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
@ 2014-04-28 22:27 suravee.suthikulpanit
  2014-05-06 18:14 ` Joerg Roedel
  2014-05-12 19:04 ` Joerg Roedel
  0 siblings, 2 replies; 5+ messages in thread
From: suravee.suthikulpanit @ 2014-04-28 22:27 UTC (permalink / raw)
  To: iommu, joro; +Cc: linux-kernel, kim.naru, jay.cornwall, Suravee Suthikulpanit

From: Jay Cornwall <jay.cornwall@amd.com>

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>
---
 drivers/iommu/amd_iommu_v2.c |    2 ++
 1 file changed, 2 insertions(+)

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);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-12 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-28 22:27 [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages suravee.suthikulpanit
2014-05-06 18:14 ` Joerg Roedel
2014-05-06 19:11   ` Suravee Suthikulanit
2014-05-06 19:27     ` Suravee Suthikulanit
2014-05-12 19:04 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox