diff options
author | Petar Jovanovic <petar.jovanovic@rt-rk.com> | 2016-07-13 15:23:37 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-07-21 12:11:21 +0200 |
commit | fcf40a9d99e95549da117fb105b06f9f8ad8e04d (patch) | |
tree | f1e982d57073f586305de52536d7f770893d3b68 | |
parent | 1dbb5b5e938b4da6b9ea57f739961a229aeb373e (diff) | |
download | linux-fcf40a9d99e95549da117fb105b06f9f8ad8e04d.tar.gz |
MIPS: traps: return correct si code for accessing nonmapped addresses
find_vma() returns the first VMA which satisfies fault_addr < vm_end, but
it does not guarantee fault_addr is actually within VMA. Therefore, kernel
has to check that before it chooses correct si code on return.
Signed-off-by: Petar Jovanovic <petar.jovanovic@rt-rk.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13808/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
(cherry picked from commit abe687d221b4e9fd564d5db76f5847636dae6c2e)
-rw-r--r-- | arch/mips/kernel/traps.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index aedbeaa6f16032..b58439df6d5784 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -699,13 +699,16 @@ asmlinkage void do_ov(struct pt_regs *regs) int process_fpemu_return(int sig, void __user *fault_addr) { + struct vm_area_struct *vma; + if (sig == SIGSEGV || sig == SIGBUS) { struct siginfo si = {0}; si.si_addr = fault_addr; si.si_signo = sig; if (sig == SIGSEGV) { down_read(¤t->mm->mmap_sem); - if (find_vma(current->mm, (unsigned long)fault_addr)) + find_vma(current->mm, (unsigned long)fault_addr); + if (vma && (vma->vm_start <= (unsigned long)fault_addr)) si.si_code = SEGV_ACCERR; else si.si_code = SEGV_MAPERR; |