]> git.baikalelectronics.ru Git - kernel.git/commitdiff
MIPS: Send SIGILL for linked branches in `__compute_return_epc_for_insn'
authorMaciej W. Rozycki <macro@imgtec.com>
Thu, 15 Jun 2017 23:12:53 +0000 (00:12 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 29 Jun 2017 00:42:27 +0000 (02:42 +0200)
Fix commit 319824eabc3f ("MIPS: kernel: branch: Do not emulate the
branch likelies on MIPS R6") and also send SIGILL rather than returning
-SIGILL for BLTZAL, BLTZALL, BGEZAL and BGEZALL instruction encodings no
longer supported in R6, except where emulated.  Returning -SIGILL is
never correct as the API defines this function's result upon error to be
-EFAULT and a signal actually issued.

Fixes: 319824eabc3f ("MIPS: kernel: branch: Do not emulate the branch likelies on MIPS R6")
Signed-off-by: Maciej W. Rozycki <macro@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: stable@vger.kernel.org # 3.19+
Patchwork: https://patchwork.linux-mips.org/patch/16398/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/branch.c

index df5c32b38408d12d02226846c86f68c1b911fb55..64c8360e3d62ee7b633f33d302ceac363a010aa5 100644 (file)
@@ -473,10 +473,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
                case bltzal_op:
                case bltzall_op:
                        if (NO_R6EMU && (insn.i_format.rs ||
-                           insn.i_format.rt == bltzall_op)) {
-                               ret = -SIGILL;
-                               break;
-                       }
+                           insn.i_format.rt == bltzall_op))
+                               goto sigill_r2r6;
                        regs->regs[31] = epc + 8;
                        /*
                         * OK we are here either because we hit a NAL
@@ -507,10 +505,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
                case bgezal_op:
                case bgezall_op:
                        if (NO_R6EMU && (insn.i_format.rs ||
-                           insn.i_format.rt == bgezall_op)) {
-                               ret = -SIGILL;
-                               break;
-                       }
+                           insn.i_format.rt == bgezall_op))
+                               goto sigill_r2r6;
                        regs->regs[31] = epc + 8;
                        /*
                         * OK we are here either because we hit a BAL