diff options
Diffstat (limited to 'arch/sh/mm/gup.c')
-rw-r--r-- | arch/sh/mm/gup.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c index 56c86ca98ecf..23fa2fc8aabc 100644 --- a/arch/sh/mm/gup.c +++ b/arch/sh/mm/gup.c @@ -242,7 +242,14 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, next = pgd_addr_end(addr, end); if (pgd_none(pgd)) goto slow; - if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) + /* + * The FAST_GUP case requires FOLL_WRITE even for pure reads, + * because get_user_pages() may need to cause an early COW in + * order to avoid confusing the normal COW routines. So only + * targets that are already writable are safe to do by just + * looking at the page tables. + */ + if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) goto slow; } while (pgdp++, addr = next, addr != end); local_irq_enable(); |