Return-Path: Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39110 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932886AbeFGOI6 (ORCPT ); Thu, 7 Jun 2018 10:08:58 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Ralf Baechle" , "Maciej W. Rozycki" , linux-mips@linux-mips.org Date: Thu, 07 Jun 2018 15:05:20 +0100 Message-ID: Subject: [PATCH 3.16 001/410] MIPS: Normalise code flow in the CpU exception handler In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: "Maciej W. Rozycki" commit 27e28e8ec47a5ce335ebf25d34ca356c80635908 upstream. Changes applied to `do_cpu' over time reduced the use of the SIGILL issued with `force_sig' at the end to a single CU3 case only in the switch statement there. Move that `force_sig' call over to right where required then and toss out the pile of gotos now not needed to skip over the call, replacing them with regular breaks out of the switch. Signed-off-by: Maciej W. Rozycki Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9683/ Signed-off-by: Ralf Baechle Signed-off-by: Ben Hutchings --- arch/mips/kernel/traps.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -1247,7 +1247,7 @@ asmlinkage void do_cpu(struct pt_regs *r status = -1; if (unlikely(compute_return_epc(regs) < 0)) - goto out; + break; if (get_isa16_mode(regs->cp0_epc)) { unsigned short mmop[2] = { 0 }; @@ -1280,7 +1280,7 @@ asmlinkage void do_cpu(struct pt_regs *r force_sig(status, current); } - goto out; + break; case 3: /* @@ -1296,8 +1296,10 @@ asmlinkage void do_cpu(struct pt_regs *r * erroneously too, so they are covered by this choice * as well. */ - if (raw_cpu_has_fpu) + if (raw_cpu_has_fpu) { + force_sig(SIGILL, current); break; + } /* Fall through. */ case 1: @@ -1320,16 +1322,13 @@ asmlinkage void do_cpu(struct pt_regs *r if (!process_fpemu_return(sig, fault_addr, fcr31) && !err) mt_ase_fp_affinity(); - goto out; + break; case 2: raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs); - goto out; + break; } - force_sig(SIGILL, current); - -out: exception_exit(prev_state); }