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,
* the fault.
*/
switch (handle_mm_fault(mm, vma, address, write)) {
case 1:
current->min_flt++;
break;
case 2:
case VM_FAULT_SIGBUS:
goto do_sigbus;
case VM_FAULT_OOM:
goto out_of_memory;
case VM_FAULT_MAJOR:
current->maj_flt++;
break;
case 0:
goto do_sigbus;
case VM_FAULT_MINOR:
default:
goto out_of_memory;
current->min_flt++;
break;
}
up_read(&mm->mmap_sem);
return;
......@@ -535,8 +536,11 @@ inline void force_user_fault(unsigned long address, int write)
if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
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;
}
up_read(&mm->mmap_sem);
return;
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