aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/memory.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mm/memory.c b/mm/memory.c
index eee7fec3ab54..7abd3899848b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2369,11 +2369,14 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2369 * address space wants to know that the page is about 2369 * address space wants to know that the page is about
2370 * to become writable 2370 * to become writable
2371 */ 2371 */
2372 if (vma->vm_ops->page_mkwrite && 2372 if (vma->vm_ops->page_mkwrite) {
2373 vma->vm_ops->page_mkwrite(vma, page) < 0) { 2373 unlock_page(page);
2374 fdata.type = VM_FAULT_SIGBUS; 2374 if (vma->vm_ops->page_mkwrite(vma, page) < 0) {
2375 anon = 1; /* no anon but release faulted_page */ 2375 fdata.type = VM_FAULT_SIGBUS;
2376 goto out; 2376 anon = 1; /* no anon but release faulted_page */
2377 goto out_unlocked;
2378 }
2379 lock_page(page);
2377 } 2380 }
2378 } 2381 }
2379 2382
@@ -2425,6 +2428,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2425 2428
2426out: 2429out:
2427 unlock_page(faulted_page); 2430 unlock_page(faulted_page);
2431out_unlocked:
2428 if (anon) 2432 if (anon)
2429 page_cache_release(faulted_page); 2433 page_cache_release(faulted_page);
2430 else if (dirty_page) { 2434 else if (dirty_page) {