Commit 2c990546 authored by William Lee Irwin III's avatar William Lee Irwin III Committed by Linus Torvalds

[PATCH] sparc32: fix missing handling for VM fault codes

Fix missing cases for vm fault codes in sparc32 fault handling, and
convert the entire file to using symbolic fault codes. This fixes a
latent bug where an allocation failure returns to the kernel instead of
delivering an error as expected.
Signed-off-by: default avatarWilliam Irwin <wli@holomorphy.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent efd14b62
...@@ -294,16 +294,17 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, ...@@ -294,16 +294,17 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
* the fault. * the fault.
*/ */
switch (handle_mm_fault(mm, vma, address, write)) { switch (handle_mm_fault(mm, vma, address, write)) {
case 1: case VM_FAULT_SIGBUS:
current->min_flt++; goto do_sigbus;
break; case VM_FAULT_OOM:
case 2: goto out_of_memory;
case VM_FAULT_MAJOR:
current->maj_flt++; current->maj_flt++;
break; break;
case 0: case VM_FAULT_MINOR:
goto do_sigbus;
default: default:
goto out_of_memory; current->min_flt++;
break;
} }
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
return; return;
...@@ -535,8 +536,11 @@ inline void force_user_fault(unsigned long address, int write) ...@@ -535,8 +536,11 @@ inline void force_user_fault(unsigned long address, int write)
if(!(vma->vm_flags & (VM_READ | VM_EXEC))) if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area; goto bad_area;
} }
if (!handle_mm_fault(mm, vma, address, write)) switch (handle_mm_fault(mm, vma, address, write)) {
case VM_FAULT_SIGBUS:
case VM_FAULT_OOM:
goto do_sigbus; goto do_sigbus;
}
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
return; return;
bad_area: bad_area:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment