diff options
author | Marcin Nowakowski <marcin.nowakowski@imgtec.com> | 2016-10-12 09:32:56 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-10-12 14:34:45 +0200 |
commit | 74f1077b5b783e7bf4fa3007cefdc8dbd6c07518 (patch) | |
tree | 82bb98c646ae13a434752ca2f5ebb2250192ac76 /arch | |
parent | 9445622cfbc38c980f1755fc1132a3a460b5a529 (diff) | |
download | talos-obmc-linux-74f1077b5b783e7bf4fa3007cefdc8dbd6c07518.tar.gz talos-obmc-linux-74f1077b5b783e7bf4fa3007cefdc8dbd6c07518.zip |
MIPS: ptrace: Fix regs_return_value for kernel context
Currently regs_return_value always negates reg[2] if it determines
the syscall has failed, but when called in kernel context this check is
invalid and may result in returning a wrong value.
This fixes errors reported by CONFIG_KPROBES_SANITY_TEST
Fixes: d7e7528bcd45 ("Audit: push audit success and retcode into arch ptrace.h")
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: stable@vger.kernel.org # 3.3+
Patchwork: https://patchwork.linux-mips.org/patch/14381/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/ptrace.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h index f6fc6aac5496..b6578611dddb 100644 --- a/arch/mips/include/asm/ptrace.h +++ b/arch/mips/include/asm/ptrace.h @@ -152,7 +152,7 @@ static inline int is_syscall_success(struct pt_regs *regs) static inline long regs_return_value(struct pt_regs *regs) { - if (is_syscall_success(regs)) + if (is_syscall_success(regs) || !user_mode(regs)) return regs->regs[2]; else return -regs->regs[2]; |