diff options
-rw-r--r-- | include/linux/mm.h | 22 | ||||
-rw-r--r-- | kernel/futex.c | 7 |
2 files changed, 26 insertions, 3 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 26f3094911a5..bc01fff3aa01 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -717,12 +717,28 @@ extern int vmtruncate(struct inode * inode, loff_t offset); | |||
717 | extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); | 717 | extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); |
718 | extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); | 718 | extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); |
719 | extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); | 719 | extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); |
720 | extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); | ||
721 | 720 | ||
722 | static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access) | 721 | #ifdef CONFIG_MMU |
722 | extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, | ||
723 | unsigned long address, int write_access); | ||
724 | |||
725 | static inline int handle_mm_fault(struct mm_struct *mm, | ||
726 | struct vm_area_struct *vma, unsigned long address, | ||
727 | int write_access) | ||
723 | { | 728 | { |
724 | return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE); | 729 | return __handle_mm_fault(mm, vma, address, write_access) & |
730 | (~VM_FAULT_WRITE); | ||
725 | } | 731 | } |
732 | #else | ||
733 | static inline int handle_mm_fault(struct mm_struct *mm, | ||
734 | struct vm_area_struct *vma, unsigned long address, | ||
735 | int write_access) | ||
736 | { | ||
737 | /* should never happen if there's no MMU */ | ||
738 | BUG(); | ||
739 | return VM_FAULT_SIGBUS; | ||
740 | } | ||
741 | #endif | ||
726 | 742 | ||
727 | extern int make_pages_present(unsigned long addr, unsigned long end); | 743 | extern int make_pages_present(unsigned long addr, unsigned long end); |
728 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); | 744 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); |
diff --git a/kernel/futex.c b/kernel/futex.c index 5e71a6bf6f6b..5efa2f978032 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -356,6 +356,13 @@ retry: | |||
356 | if (bh1 != bh2) | 356 | if (bh1 != bh2) |
357 | spin_unlock(&bh2->lock); | 357 | spin_unlock(&bh2->lock); |
358 | 358 | ||
359 | #ifndef CONFIG_MMU | ||
360 | /* we don't get EFAULT from MMU faults if we don't have an MMU, | ||
361 | * but we might get them from range checking */ | ||
362 | ret = op_ret; | ||
363 | goto out; | ||
364 | #endif | ||
365 | |||
359 | if (unlikely(op_ret != -EFAULT)) { | 366 | if (unlikely(op_ret != -EFAULT)) { |
360 | ret = op_ret; | 367 | ret = op_ret; |
361 | goto out; | 368 | goto out; |