iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Take mmap_sem when calling get_user_pages
@ 2014-04-28 22:27 suravee.suthikulpanit-5C7GfCeVMHo
  2014-05-06 18:14 ` Joerg Roedel
       [not found] ` <1398724066-3730-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: suravee.suthikulpanit-5C7GfCeVMHo @ 2014-04-28 22:27 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	joro-zLv9SwRftAIdnm+yROfE0A
  Cc: jay.cornwall-5C7GfCeVMHo, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kim.naru-5C7GfCeVMHo

From: Jay Cornwall <jay.cornwall-5C7GfCeVMHo@public.gmane.org>

get_user_pages requires caller to hold a read lock on mmap_sem.

Signed-off-by: Jay Cornwall <jay.cornwall-5C7GfCeVMHo@public.gmane.org>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
---
 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-5C7GfCeVMHo
2014-05-06 18:14 ` Joerg Roedel
2014-05-06 19:11   ` Suravee Suthikulanit
2014-05-06 19:27     ` Suravee Suthikulanit
     [not found] ` <1398724066-3730-1-git-send-email-suravee.suthikulpanit-5C7GfCeVMHo@public.gmane.org>
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;
as well as URLs for NNTP newsgroup(s).