diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index 122d965e820f..f594bb65a9f1 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1264,9 +1264,15 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1264 | * do_wp_page has broken COW when necessary, | 1264 | * do_wp_page has broken COW when necessary, |
1265 | * even if maybe_mkwrite decided not to set | 1265 | * even if maybe_mkwrite decided not to set |
1266 | * pte_write. We can thus safely do subsequent | 1266 | * pte_write. We can thus safely do subsequent |
1267 | * page lookups as if they were reads. | 1267 | * page lookups as if they were reads. But only |
1268 | * do so when looping for pte_write is futile: | ||
1269 | * in some cases userspace may also be wanting | ||
1270 | * to write to the gotten user page, which a | ||
1271 | * read fault here might prevent (a readonly | ||
1272 | * page might get reCOWed by userspace write). | ||
1268 | */ | 1273 | */ |
1269 | if (ret & VM_FAULT_WRITE) | 1274 | if ((ret & VM_FAULT_WRITE) && |
1275 | !(vma->vm_flags & VM_WRITE)) | ||
1270 | foll_flags &= ~FOLL_WRITE; | 1276 | foll_flags &= ~FOLL_WRITE; |
1271 | 1277 | ||
1272 | cond_resched(); | 1278 | cond_resched(); |